// File: /workspace/github_c_makefile_star2_O3/ksherlock[P]nroff_man/read3.c
// Function: tc_init
void tc_init(void) {
	static char buffer[1024];
	static char buffer2[1024];
	const char *term;
	char *cp;
	char *pcap;
	int ok;

	term = flags.t ? flags.t : getenv("TERM");
	if (!term || !*term) {
		warnx("TERM undefined."); return;
	}

	ok = tgetent(buffer, term);
	if (ok < 0) {
		warnx("No termcap for %s", term);
		return;
	}

	tcap_buffer_offset = 0;

	pcap = buffer2;
	if (!flags.i) {
		/* ZH/ZR are italic begin/end.  Not usually supported. */

		cp = tgetstr("ZH", &pcap);
		if (cp) {
			italic_begin = tcap_buffer + tcap_buffer_offset;
			tputs(cp, 0, tputs_helper);
			tcap_buffer[tcap_buffer_offset++] = 0;
		}
		cp = tgetstr("ZR", &pcap);
		if (cp) {
			italic_end = tcap_buffer + tcap_buffer_offset;
			tputs(cp, 0, tputs_helper);
			tcap_buffer[tcap_buffer_offset++] = 0;
		}

		if (!italic_begin) {
			cp = tgetstr("us", &pcap);
			if (cp) {
				italic_begin = tcap_buffer + tcap_buffer_offset;
				tputs(cp, 0, tputs_helper);
				tcap_buffer[tcap_buffer_offset++] = 0;
			}
			cp = tgetstr("ue", &pcap);
			if (cp) {
				italic_end = tcap_buffer + tcap_buffer_offset;
				tputs(cp, 0, tputs_helper);
				tcap_buffer[tcap_buffer_offset++] = 0;
			}
		}
	}

	if (!flags.b) {
		cp = tgetstr("md", &pcap);
		if (cp) {
			bold_begin = tcap_buffer + tcap_buffer_offset;
			tputs(cp, 0, tputs_helper);
			tcap_buffer[tcap_buffer_offset++] = 0;
		}
		cp = tgetstr("me", &pcap);
		if (cp) {
			bold_end = tcap_buffer + tcap_buffer_offset;
			tputs(cp, 0, tputs_helper);
			tcap_buffer[tcap_buffer_offset++] = 0;
		}

		if (!bold_begin) {
			cp = tgetstr("so", &pcap);
			if (cp) {
				bold_begin = tcap_buffer + tcap_buffer_offset;
				tputs(cp, 0, tputs_helper);
				tcap_buffer[tcap_buffer_offset++] = 0;
			}
			cp = tgetstr("se", &pcap);
			if (cp) {
				bold_end = tcap_buffer + tcap_buffer_offset;
				tputs(cp, 0, tputs_helper);
				tcap_buffer[tcap_buffer_offset++] = 0;
			}
		}
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x8071(%rip), %r14      # 0xe378
movq 0x18(%r14), %rbx
testq %rbx, %rbx
jne 0x6328
leaq 0x3595(%rip), %rdi      # 0x98ac
callq 0x4030
movq %rax, %rbx
testq %rax, %rax
je 0x660f
cmpb $0x0, (%rbx)
je 0x660f
leaq 0x9978(%rip), %rdi      # 0xfcb0
movq %rbx, %rsi
callq 0x41b0
testl %eax, %eax
js 0x6624
movl $0x0, 0xa15e(%rip)      # 0x104b0
leaq 0x9d57(%rip), %rax      # 0x100b0
movq %rax, (%rsp)
cmpl $0x0, 0x4(%r14)
jne 0x64b2
leaq 0x3564(%rip), %rdi      # 0x98d3
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x63b7
movl 0xa12e(%rip), %ecx      # 0x104b0
leaq 0xa137(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x990d(%rip)      # 0xfca0
leaq 0x2a2(%rip), %rdx       # 0x663c
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa106(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa0fd(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x3518(%rip), %rdi      # 0x98d6
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x6406
movl 0xa0df(%rip), %ecx      # 0x104b0
leaq 0xa0e8(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x98c6(%rip)      # 0xfca8
leaq 0x253(%rip), %rdx       # 0x663c
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa0b7(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa0ae(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpq $0x0, 0x9892(%rip)      # 0xfca0
jne 0x64b2
leaq 0x34be(%rip), %rdi      # 0x98d9
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x6463
movl 0xa082(%rip), %ecx      # 0x104b0
leaq 0xa08b(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9861(%rip)      # 0xfca0
leaq 0x1f6(%rip), %rdx       # 0x663c
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa05a(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa051(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x3472(%rip), %rdi      # 0x98dc
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x64b2
movl 0xa033(%rip), %ecx      # 0x104b0
leaq 0xa03c(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x981a(%rip)      # 0xfca8
leaq 0x1a7(%rip), %rdx       # 0x663c
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa00b(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa002(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpl $0x0, 0x8(%r14)
jne 0x6607
leaq 0x341b(%rip), %rdi      # 0x98df
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x650c
movl 0x9fd9(%rip), %ecx      # 0x104b0
leaq 0x9fe2(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x97a8(%rip)      # 0xfc90
leaq 0x14d(%rip), %rdx       # 0x663c
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9fb1(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9fa8(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x33cf(%rip), %rdi      # 0x98e2
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x655b
movl 0x9f8a(%rip), %ecx      # 0x104b0
leaq 0x9f93(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9761(%rip)      # 0xfc98
leaq 0xfe(%rip), %rdx        # 0x663c
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9f62(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9f59(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpq $0x0, 0x972d(%rip)      # 0xfc90
jne 0x6607
leaq 0x307e(%rip), %rdi      # 0x95ee
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x65b8
movl 0x9f2d(%rip), %ecx      # 0x104b0
leaq 0x9f36(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x96fc(%rip)      # 0xfc90
leaq 0xa1(%rip), %rdx        # 0x663c
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9f05(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9efc(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x3389(%rip), %rdi      # 0x9948
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x6607
movl 0x9ede(%rip), %ecx      # 0x104b0
leaq 0x9ee7(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x96b5(%rip)      # 0xfc98
leaq 0x52(%rip), %rdx        # 0x663c
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9eb6(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9ead(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x329b(%rip), %rdi      # 0x98b1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x40a0
leaq 0x3296(%rip), %rdi      # 0x98c1
movq %rbx, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x40a0