// File: /workspace/github_c_makefile_star2_O2/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 0x8549(%rip), %r14      # 0xe378
movq 0x18(%r14), %rbx
testq %rbx, %rbx
jne 0x5e50
leaq 0x3a6d(%rip), %rdi      # 0x98ac
callq 0x4030
movq %rax, %rbx
testq %rax, %rax
je 0x6134
cmpb $0x0, (%rbx)
je 0x6134
leaq 0x9e50(%rip), %rdi      # 0xfcb0
movq %rbx, %rsi
callq 0x41b0
testl %eax, %eax
js 0x6149
andl $0x0, 0xa639(%rip)      # 0x104b0
leaq 0xa232(%rip), %rax      # 0x100b0
movq %rax, (%rsp)
cmpl $0x0, 0x4(%r14)
jne 0x5fd7
leaq 0x3a3f(%rip), %rdi      # 0x98d3
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x5edc
movl 0xa609(%rip), %ecx      # 0x104b0
leaq 0xa612(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9de8(%rip)      # 0xfca0
leaq 0x2a2(%rip), %rdx       # 0x6161
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa5e1(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa5d8(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x39f3(%rip), %rdi      # 0x98d6
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x5f2b
movl 0xa5ba(%rip), %ecx      # 0x104b0
leaq 0xa5c3(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9da1(%rip)      # 0xfca8
leaq 0x253(%rip), %rdx       # 0x6161
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa592(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa589(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpq $0x0, 0x9d6d(%rip)      # 0xfca0
jne 0x5fd7
leaq 0x3999(%rip), %rdi      # 0x98d9
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x5f88
movl 0xa55d(%rip), %ecx      # 0x104b0
leaq 0xa566(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9d3c(%rip)      # 0xfca0
leaq 0x1f6(%rip), %rdx       # 0x6161
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa535(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa52c(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x394d(%rip), %rdi      # 0x98dc
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x5fd7
movl 0xa50e(%rip), %ecx      # 0x104b0
leaq 0xa517(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9cf5(%rip)      # 0xfca8
leaq 0x1a7(%rip), %rdx       # 0x6161
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa4e6(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa4dd(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpl $0x0, 0x8(%r14)
jne 0x612c
leaq 0x38f6(%rip), %rdi      # 0x98df
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x6031
movl 0xa4b4(%rip), %ecx      # 0x104b0
leaq 0xa4bd(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9c83(%rip)      # 0xfc90
leaq 0x14d(%rip), %rdx       # 0x6161
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa48c(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa483(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x38aa(%rip), %rdi      # 0x98e2
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x6080
movl 0xa465(%rip), %ecx      # 0x104b0
leaq 0xa46e(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9c3c(%rip)      # 0xfc98
leaq 0xfe(%rip), %rdx        # 0x6161
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa43d(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa434(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
cmpq $0x0, 0x9c08(%rip)      # 0xfc90
jne 0x612c
leaq 0x3559(%rip), %rdi      # 0x95ee
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x60dd
movl 0xa408(%rip), %ecx      # 0x104b0
leaq 0xa411(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9bd7(%rip)      # 0xfc90
leaq 0xa1(%rip), %rdx        # 0x6161
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa3e0(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa3d7(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
leaq 0x3864(%rip), %rdi      # 0x9948
movq %rsp, %rsi
callq 0x4140
testq %rax, %rax
je 0x612c
movl 0xa3b9(%rip), %ecx      # 0x104b0
leaq 0xa3c2(%rip), %rbx      # 0x104c0
addq %rbx, %rcx
movq %rcx, 0x9b90(%rip)      # 0xfc98
leaq 0x52(%rip), %rdx        # 0x6161
movq %rax, %rdi
xorl %esi, %esi
callq 0x4050
movl 0xa391(%rip), %eax      # 0x104b0
leal 0x1(%rax), %ecx
movl %ecx, 0xa388(%rip)      # 0x104b0
movb $0x0, (%rax,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x3776(%rip), %rdi      # 0x98b1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x40a0
leaq 0x3771(%rip), %rdi      # 0x98c1
movq %rbx, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x40a0