// File: /workspace/github_c_makefile_star2_O1/ksherlock[P]nroff_man/read2.c
// Function: read_text
const unsigned char *read_text(void) {

	unsigned ff = 0;
	for(;;) {
		const unsigned char *cp = read_line();
		if (type == tkEOF) return NULL;

		switch(type) {
			case tkDT:
				continue;
			case tkUR:
			case tkUE:
			case tkMT:
			case tkME:
			case tkIX:
				continue;

			/* next-line fonts */
			case tkB:
			case tkSB:
				ff = FONT_B;
				if (argc) return font(ff);
				continue;
			case tkR:
			case tkSM:
				ff = FONT_R;
				if (argc) return font(ff);
				continue;
			case tkI:
				ff = FONT_I;
				if (argc) return font(ff);
				continue;
			case tkSY:
				/* bold up argv0 but retain the type */
				if (argc) {
					unsigned i;
					buffer[0] = FONT_B;
					i = xstrcpy(buffer+1, argv[0]);
					/* pre-increment to adjust for buffer+1 */
					buffer[++i] = FONT_R;
					buffer[++i] = 0;
					argv[0] = buffer;
					return "";
				}

			/* current-line fonts */
			case tkBI: return fonts(FONT_B, FONT_I);
			case tkBR: return fonts(FONT_B, FONT_R);
			case tkIB: return fonts(FONT_I, FONT_B);
			case tkIR: return fonts(FONT_I, FONT_R);
			case tkRI: return fonts(FONT_R, FONT_I);
			case tkRB: return fonts(FONT_R, FONT_B);

			/* plan-9 Manual Reference.  First word is italic */
			case tkMR: return font_first_word(FONT_I);

			case tkOP: {
				unsigned i;

				if (argc == 0) continue;
				buffer[0] = '[';
				buffer[1] = FONT_B;
				i = 2 + xstrcpy(buffer+2, argv[0]);
				buffer[i++] = FONT_R;
				if (argc > 1) {
					buffer[i++] = NBSPACE;
					buffer[i++] = FONT_I;
					i += xstrcpy(buffer + i, argv[1]);
					buffer[i++] = FONT_R;
				}
				buffer[i++] = ']'; 
				buffer[i] = 0; 
				type = tkTEXT;
				return buffer;
			}

			case tkTEXT:
				if (ff) {
					unsigned i;
					buffer[0] = ff;
					i = xstrcpy(buffer+1, cp);
					/* pre-increment to adjust for buffer+1 */
					buffer[++i] = FONT_R;
					buffer[++i] = 0;
					ff = 0;
					return buffer;
				}
			default:
				return cp;
		}

	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %r13d, %r13d
leaq 0x8215(%rip), %r14      # 0xe310
leaq 0x35fa(%rip), %r15      # 0x96fc
leaq 0x9367(%rip), %r12      # 0xf470
leaq 0x92b0(%rip), %rbp      # 0xf3c0
callq 0x4ad6
movl (%r14), %ecx
cmpq $0x25, %rcx
ja 0x6254
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
movb $0x1, %cl
jmp 0x6384
leaq 0x8227(%rip), %rax      # 0xe360
cmpl $0x0, (%rax)
je 0x638e
movl $0x84, %r13d
movl $0x84, %edi
jmp 0x61ee
leaq 0x8207(%rip), %rax      # 0xe360
cmpl $0x0, (%rax)
je 0x6399
movl $0x83, %r13d
movl $0x83, %edi
jmp 0x61ee
movl $0x85, %edi
jmp 0x61fd
leaq 0x81e0(%rip), %rax      # 0xe360
cmpl $0x0, (%rax)
je 0x61c9
movb $-0x7c, 0x92e4(%rip)    # 0xf470
movq (%rbp), %rcx
movl $0x1, %eax
leal -0x1(%rax), %edx
movb (%rcx,%rdx), %sil
movb %sil, 0x1(%rdx,%r12)
incl %eax
testb %sil, %sil
jne 0x6195
leal -0x1(%rax), %ecx
movb $-0x7d, (%rcx,%r12)
movl %eax, %eax
movb $0x0, (%rax,%r12)
movq %r12, (%rbp)
xorl %ecx, %ecx
leaq 0x3c7e(%rip), %rbx      # 0x9e42
jmp 0x6384
movl $0x84, %edi
jmp 0x6375
leaq 0x8186(%rip), %rax      # 0xe360
cmpl $0x0, (%rax)
je 0x63a4
movl $0x85, %r13d
movl $0x85, %edi
callq 0x63e6
jmp 0x637f
movl $0x83, %edi
movl $0x84, %esi
jmp 0x637a
movl $0x84, %edi
jmp 0x6263
xorl %ecx, %ecx
xorl %ebx, %ebx
jmp 0x6384
testl %r13d, %r13d
je 0x6254
movb %r13b, 0x924d(%rip)     # 0xf470
movl $0x1, %ecx
leal -0x1(%rcx), %edx
movb (%rax,%rdx), %sil
movb %sil, 0x1(%rdx,%r12)
incl %ecx
testb %sil, %sil
jne 0x6228
leal -0x1(%rcx), %eax
movb $-0x7d, (%rax,%r12)
movl %ecx, %eax
movb $0x0, (%rax,%r12)
xorl %ecx, %ecx
xorl %r13d, %r13d
jmp 0x6381
xorl %ecx, %ecx
movq %rax, %rbx
jmp 0x6384
movl $0x85, %edi
movl $0x83, %esi
jmp 0x637a
leaq 0x80ec(%rip), %rax      # 0xe360
movl (%rax), %eax
testq %rax, %rax
je 0x637f
movb $-0x7b, 0x91ea(%rip)    # 0xf470
movl $0x1, (%r14)
testl %eax, %eax
jle 0x63c8
movl $0x1, %ecx
xorl %edx, %edx
movq (%rbp,%rdx,8), %rsi
movb (%rsi), %dil
testb %dil, %dil
je 0x62c7
movslq %ecx, %r8
xorl %r9d, %r9d
leaq (%r8,%r9), %r10
movb %dil, (%r12,%r10)
movb 0x1(%rsi,%r9), %dil
incq %r9
testb %dil, %dil
jne 0x62af
addl %r9d, %ecx
testq %rdx, %rdx
jne 0x62d6
movslq %ecx, %rsi
incl %ecx
movb $-0x7d, (%rsi,%r12)
incq %rdx
cmpq %rax, %rdx
jne 0x629c
movslq %ecx, %rax
jmp 0x63cd
leaq 0x8073(%rip), %rax      # 0xe360
movl (%rax), %edx
testl %edx, %edx
sete %cl
je 0x6384
movw $0x845b, 0x916d(%rip)   # imm = 0x845B
movq (%rbp), %rsi
movl $0x4, %ecx
movl $0x5, %edi
movl %edi, %eax
leal -0x4(%rcx), %edi
movb (%rsi,%rdi), %r8b
movb %r8b, 0x2(%rdi,%r12)
incl %ecx
leal 0x1(%rax), %edi
testb %r8b, %r8b
jne 0x6311
leal -0x3(%rcx), %edi
leal -0x2(%rcx), %esi
movb $-0x7d, (%rdi,%r12)
cmpl $0x2, %edx
jl 0x63af
leal -0x1(%rcx), %edx
movl %esi, %esi
movb $-0x80, (%rsi,%r12)
movb $-0x7b, (%rdx,%r12)
movl %ecx, %ecx
movq 0x8(%rbp), %rdx
xorl %esi, %esi
movl %esi, %edi
movb (%rdx,%rdi), %r8b
addq %rcx, %rdi
movb %r8b, (%r12,%rdi)
incl %esi
incl %eax
testb %r8b, %r8b
jne 0x6350
leal -0x1(%rax), %ecx
movb $-0x7d, (%rcx,%r12)
jmp 0x63b1
movl $0x83, %edi
movl $0x85, %esi
callq 0x6471
xorl %ecx, %ecx
movq %r12, %rbx
testb %cl, %cl
jne 0x6110
jmp 0x63d4
movl $0x84, %r13d
jmp 0x612b
movl $0x83, %r13d
jmp 0x612b
movl $0x85, %r13d
jmp 0x612b
movl %esi, %eax
movl %eax, %ecx
incl %eax
movb $0x5d, (%rcx,%r12)
movb $0x0, (%rax,%r12)
movl $0x1, (%r14)
jmp 0x637f
movl $0x1, %eax
movb $0x0, (%rax,%r12)
jmp 0x637f
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq