// File: /workspace/github_c_makefile_star2_O1/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 0x7e69(%rip), %r14      # 0xe378
movq 0x18(%r14), %rbx
testq %rbx, %rbx
jne 0x6527
leaq 0x339d(%rip), %rdi      # 0x98bc
callq 0x4030
movq %rax, %rbx
testq %rbx, %rbx
je 0x6817
cmpb $0x0, (%rbx)
je 0x6817
leaq 0x9770(%rip), %rdi      # 0xfcb0
movq %rbx, %rsi
callq 0x41c0
testl %eax, %eax
js 0x682c
movl $0x0, 0x9f56(%rip)      # 0x104b0
leaq 0x9b4f(%rip), %rax      # 0x100b0
movq %rax, (%rsp)
cmpl $0x0, 0x4(%r14)
jne 0x66ba
leaq 0x336c(%rip), %rdi      # 0x98e3
movq %rsp, %rsi
callq 0x4150
testq %rax, %rax
je 0x65bf
movl 0x9f26(%rip), %ecx      # 0x104b0
leaq 0x9f2f(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9705(%rip)      # 0xfca0
leaq 0x2a2(%rip), %rdx       # 0x6844
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9efe(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9ef5(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x3320(%rip), %rdi      # 0x98e6
movq %rsp, %rsi
callq 0x4150
testq %rax, %rax
je 0x660e
movl 0x9ed7(%rip), %ecx      # 0x104b0
leaq 0x9ee0(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x96be(%rip)      # 0xfca8
leaq 0x253(%rip), %rdx       # 0x6844
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9eaf(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9ea6(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpq $0x0, 0x968a(%rip)      # 0xfca0
jne 0x66ba
leaq 0x32c6(%rip), %rdi      # 0x98e9
movq %rsp, %rsi
callq 0x4150
testq %rax, %rax
je 0x666b
movl 0x9e7a(%rip), %ecx      # 0x104b0
leaq 0x9e83(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9659(%rip)      # 0xfca0
leaq 0x1f6(%rip), %rdx       # 0x6844
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9e52(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9e49(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x327a(%rip), %rdi      # 0x98ec
movq %rsp, %rsi
callq 0x4150
testq %rax, %rax
je 0x66ba
movl 0x9e2b(%rip), %ecx      # 0x104b0
leaq 0x9e34(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9612(%rip)      # 0xfca8
leaq 0x1a7(%rip), %rdx       # 0x6844
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9e03(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9dfa(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpl $0x0, 0x8(%r14)
jne 0x680f
leaq 0x3223(%rip), %rdi      # 0x98ef
movq %rsp, %rsi
callq 0x4150
testq %rax, %rax
je 0x6714
movl 0x9dd1(%rip), %ecx      # 0x104b0
leaq 0x9dda(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x95a0(%rip)      # 0xfc90
leaq 0x14d(%rip), %rdx       # 0x6844
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9da9(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9da0(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x31d7(%rip), %rdi      # 0x98f2
movq %rsp, %rsi
callq 0x4150
testq %rax, %rax
je 0x6763
movl 0x9d82(%rip), %ecx      # 0x104b0
leaq 0x9d8b(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9559(%rip)      # 0xfc98
leaq 0xfe(%rip), %rdx        # 0x6844
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9d5a(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9d51(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpq $0x0, 0x9525(%rip)      # 0xfc90
jne 0x680f
leaq 0x2e7a(%rip), %rdi      # 0x95f2
movq %rsp, %rsi
callq 0x4150
testq %rax, %rax
je 0x67c0
movl 0x9d25(%rip), %ecx      # 0x104b0
leaq 0x9d2e(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x94f4(%rip)      # 0xfc90
leaq 0xa1(%rip), %rdx        # 0x6844
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9cfd(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9cf4(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x3191(%rip), %rdi      # 0x9958
movq %rsp, %rsi
callq 0x4150
testq %rax, %rax
je 0x680f
movl 0x9cd6(%rip), %ecx      # 0x104b0
leaq 0x9cdf(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x94ad(%rip)      # 0xfc98
leaq 0x52(%rip), %rdx        # 0x6844
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0x9cae(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0x9ca5(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x30a3(%rip), %rdi      # 0x98c1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x40b0
leaq 0x309e(%rip), %rdi      # 0x98d1
movq %rbx, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x40b0