// File: /workspace/github_c_makefile_star2_O3/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 %rbx
pushq %rax
xorl %ebp, %ebp
leaq 0x83d6(%rip), %rbx      # 0xe310
leaq 0x37b7(%rip), %r15      # 0x96f8
leaq 0x8418(%rip), %r14      # 0xe360
callq 0x4a1c
movl (%rbx), %ecx
cmpq $0x25, %rcx
ja 0x610a
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
movl (%r14), %esi
testl %esi, %esi
je 0x5f48
jmp 0x6115
movl $0x84, %ebp
cmpl $0x0, (%r14)
je 0x5f48
jmp 0x61c8
movl $0x83, %ebp
cmpl $0x0, (%r14)
je 0x5f48
jmp 0x61cf
movl $0x85, %ebp
cmpl $0x0, (%r14)
je 0x5f48
movl $0x85, %edi
jmp 0x61d4
movl $0x83, %edi
jmp 0x600b
movl $0x85, %edi
jmp 0x60ed
cmpl $0x0, (%r14)
je 0x6006
movb $-0x7c, 0x94af(%rip)    # 0xf470
leaq 0x93f8(%rip), %rax      # 0xf3c0
movq (%rax), %rsi
movl $0x1, %edx
leaq 0x9499(%rip), %rcx      # 0xf470
leal -0x1(%rdx), %edi
movb (%rsi,%rdi), %r8b
movb %r8b, 0x1(%rdi,%rcx)
incl %edx
testb %r8b, %r8b
jne 0x5fd7
leal -0x1(%rdx), %esi
movb $-0x7d, (%rsi,%rcx)
movl %edx, %edx
movb $0x0, (%rdx,%rcx)
movq %rcx, (%rax)
leaq 0x3e31(%rip), %rax      # 0x9e32
jmp 0x610a
movl $0x84, %edi
movl $0x85, %esi
jmp 0x60fe
testl %ebp, %ebp
je 0x610a
movb %bpl, 0x944c(%rip)      # 0xf470
movl $0x1, %edx
leaq 0x9440(%rip), %rcx      # 0xf470
leal -0x1(%rdx), %esi
movb (%rax,%rsi), %dil
movb %dil, 0x1(%rsi,%rcx)
incl %edx
testb %dil, %dil
jne 0x6030
leal -0x1(%rdx), %eax
movb $-0x7d, (%rax,%rcx)
movl %edx, %eax
movb $0x0, (%rax,%rcx)
movq %rcx, %rax
jmp 0x610a
xorl %eax, %eax
jmp 0x610a
movl $0x85, %edi
jmp 0x60f9
movl (%r14), %eax
testq %rax, %rax
je 0x6103
movb $-0x7b, 0x93f4(%rip)    # 0xf470
movl $0x1, (%rbx)
testl %eax, %eax
jle 0x61b3
movl $0x1, %ecx
xorl %edx, %edx
leaq 0x9328(%rip), %rsi      # 0xf3c0
leaq 0x93d1(%rip), %rdi      # 0xf470
movq (%rsi,%rdx,8), %r8
movb (%r8), %r9b
testb %r9b, %r9b
je 0x60c9
movslq %ecx, %r10
xorl %r11d, %r11d
leaq (%r10,%r11), %rbx
movb %r9b, (%rdi,%rbx)
movb 0x1(%r8,%r11), %r9b
incq %r11
testb %r9b, %r9b
jne 0x60b1
addl %r11d, %ecx
testq %rdx, %rdx
jne 0x60d8
movslq %ecx, %r8
incl %ecx
movb $-0x7d, (%r8,%rdi)
incq %rdx
cmpq %rax, %rdx
jne 0x609f
movslq %ecx, %rcx
jmp 0x61b8
movl $0x84, %edi
movl $0x83, %esi
jmp 0x60fe
movl $0x83, %edi
movl $0x84, %esi
callq 0x6269
leaq 0x9366(%rip), %rax      # 0xf470
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movw $0x845b, 0x9352(%rip)   # imm = 0x845B
leaq 0x929b(%rip), %rdx      # 0xf3c0
movq (%rdx), %rdi
xorl %ecx, %ecx
leaq 0x933f(%rip), %rax      # 0xf470
movl %ecx, %r8d
movb (%rdi,%r8), %r9b
movb %r9b, 0x2(%r8,%rax)
incl %ecx
testb %r9b, %r9b
jne 0x6131
leal 0x1(%rcx), %r8d
leal 0x2(%rcx), %edi
movb $-0x7d, (%r8,%rax)
cmpl $0x2, %esi
jl 0x619c
leal 0x3(%rcx), %esi
leal 0x3(%rcx), %r8d
movl %edi, %r9d
leaq 0x930a(%rip), %rdi      # 0xf470
movb $-0x80, (%r9,%rdi)
addl $0x4, %ecx
movb $-0x7b, (%r8,%rdi)
movq 0x8(%rdx), %rdx
xorl %r8d, %r8d
movl %r8d, %r9d
movb (%rdx,%r9), %r10b
addq %rcx, %r9
movb %r10b, (%rdi,%r9)
incl %r8d
incl %esi
testb %r10b, %r10b
jne 0x617a
movl %esi, %ecx
incl %esi
movb $-0x7d, (%rcx,%rdi)
movl %esi, %edi
movl %edi, %ecx
incl %edi
movb $0x5d, (%rcx,%rax)
movb $0x0, (%rdi,%rax)
movl $0x1, (%rbx)
jmp 0x610a
movl $0x1, %ecx
leaq 0x92b1(%rip), %rax      # 0xf470
movb $0x0, (%rcx,%rax)
jmp 0x610a
movl $0x84, %edi
jmp 0x61d4
movl $0x83, %edi
callq 0x61de
jmp 0x6103