// File: /workspace/github_c_makefile_star2_O0/ksherlock[P]nroff_man/read3.c
// Function: th
static void th(void) {
	/* .TH title section date [source [volume]] */

	/* header */
	/* #{title}(#{section}) - #{volume} - #{title}(#{section}) */
	/* footer */
	/* #{source} - #{date} - #{title}(#{section}) */
	/* GNO man uses Page # right footer */

	const unsigned char *title = NULL;
	const unsigned char *section = NULL;
	const unsigned char *date = NULL;
	const unsigned char *source = NULL;
	const unsigned char *volume = NULL;

	unsigned i, j, l;


	if (argc >= 1) title = argv[0];
	if (argc >= 2) section = argv[1];
	if (argc >= 3) date = argv[2];
	if (argc >= 4) source = argv[3];
	if (argc >= 5) volume = argv[4];

	header[0] = 0;
	footer[0] = 0;

	if (source) {
		if (th_source) free(th_source);
		th_source = strdup(source);
	}


	#define _(x) volume = x; break
	if (!volume) {
		switch(get_int(section)) {
			case 1: _("General Commands Manual");
			case 2: _("System Calls Manual");
			case 3: _("Library Functions Manual");
			case 4: _("Device Drivers Manual");
			case 5: _("File Formats Manual");
			case 6: _("Games Manual");
			case 7: _("Miscellaneous Information Manual");
			case 8: _("System Manager\'s Manual");
			case 9: _("Kernel Developer\'s Manual");
			default: _("");
		}
	}
	#undef x

	if (!title) title = "";
	if (!section) section = "";
	if (!date) date = "";
	if (!volume) volume = "";

	memset(header, ' ', 78);	
	memset(footer, ' ', 78);
	header[78] = 0;	
	footer[78] = 0;	

	/*
	 todo - truncate if strlen(title) * 2 + strlen(section) * 2 + 4 + strlen()
	*/
	j = 0;
	for(i = 0; ; ++i) { char c = title[i]; if (!c) break; header[j++] = c; }
	header[j++] = '(';
	for(i = 0; ; ++i) { char c = section[i]; if (!c) break; header[j++] = c; }
	header[j++] = ')';
	/* mirror at the end of the string. */
	for (i = 0; i < j; ++i) {
		char c = header[i];
		header[78 - j + i] = c;
		footer[78 - j + i] = c;
	}

	l = strlen(volume);
	j = (78 - l) >> 1;
	for (i = 0; ; ++i) { char c = volume[i]; if (!c) break; header[j++] = c; }

	l = strlen(date);
	j = (78 - l) >> 1;
	for (i = 0; ; ++i) { char c = date[i]; if (!c) break; footer[j++] = c; }


	fputs(header, stdout);
	fputs("\n\n\n", stdout);
	line += 3;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq $0x0, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
leaq 0x7fe9(%rip), %rax      # 0x102c0
cmpl $0x1, (%rax)
jl 0x82ea
leaq 0x903d(%rip), %rax      # 0x11320
movq (%rax), %rax
movq %rax, -0x8(%rbp)
leaq 0x7fcf(%rip), %rax      # 0x102c0
cmpl $0x2, (%rax)
jl 0x8305
leaq 0x9023(%rip), %rax      # 0x11320
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
leaq 0x7fb4(%rip), %rax      # 0x102c0
cmpl $0x3, (%rax)
jl 0x8320
leaq 0x9008(%rip), %rax      # 0x11320
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
leaq 0x7f99(%rip), %rax      # 0x102c0
cmpl $0x4, (%rax)
jl 0x833b
leaq 0x8fed(%rip), %rax      # 0x11320
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
leaq 0x7f7e(%rip), %rax      # 0x102c0
cmpl $0x5, (%rax)
jl 0x8356
leaq 0x8fd2(%rip), %rax      # 0x11320
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movb $0x0, 0xa4e3(%rip)      # 0x12840
movb $0x0, 0xa52c(%rip)      # 0x12890
cmpq $0x0, -0x20(%rbp)
je 0x8391
cmpq $0x0, 0xa4bd(%rip)      # 0x12830
je 0x8381
movq 0xa4b4(%rip), %rdi      # 0x12830
callq 0x4040
movq -0x20(%rbp), %rdi
callq 0x41a0
movq %rax, 0xa49f(%rip)      # 0x12830
cmpq $0x0, -0x28(%rbp)
jne 0x844c
movq -0x10(%rbp), %rdi
callq 0x75a0
decl %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x8, %eax
ja 0x843f
movq -0x48(%rbp), %rax
leaq 0x3aa7(%rip), %rcx      # 0xbe68
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3bdc(%rip), %rax      # 0xbfad
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3be7(%rip), %rax      # 0xbfc5
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3bee(%rip), %rax      # 0xbfd9
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3bfa(%rip), %rax      # 0xbff2
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3c03(%rip), %rax      # 0xc008
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3c0a(%rip), %rax      # 0xc01c
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3c0a(%rip), %rax      # 0xc029
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3c1e(%rip), %rax      # 0xc04a
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3c29(%rip), %rax      # 0xc062
movq %rax, -0x28(%rbp)
jmp 0x844a
leaq 0x3fcc(%rip), %rax      # 0xc412
movq %rax, -0x28(%rbp)
jmp 0x844c
cmpq $0x0, -0x8(%rbp)
jne 0x845e
leaq 0x3fb8(%rip), %rax      # 0xc412
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x8470
leaq 0x3fa6(%rip), %rax      # 0xc412
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x8482
leaq 0x3f94(%rip), %rax      # 0xc412
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x8494
leaq 0x3f82(%rip), %rax      # 0xc412
movq %rax, -0x28(%rbp)
leaq 0xa3a5(%rip), %rdi      # 0x12840
movl $0x20, %esi
movl $0x4e, %edx
callq 0x40d0
leaq 0xa3df(%rip), %rdi      # 0x12890
movl $0x20, %esi
movl $0x4e, %edx
callq 0x40d0
movb $0x0, 0xa3c7(%rip)      # 0x1288e
movb $0x0, 0xa410(%rip)      # 0x128de
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x35(%rbp)
cmpb $0x0, -0x35(%rbp)
jne 0x84f1
jmp 0x8518
movb -0x35(%rbp), %dl
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa336(%rip), %rax      # 0x12840
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x84dc
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa312(%rip), %rax      # 0x12840
movb $0x28, (%rax,%rcx)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x36(%rbp)
cmpb $0x0, -0x36(%rbp)
jne 0x854e
jmp 0x8575
movb -0x36(%rbp), %dl
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa2d9(%rip), %rax      # 0x12840
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x8539
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa2b5(%rip), %rax      # 0x12840
movb $0x29, (%rax,%rcx)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0x85f3
movl -0x2c(%rbp), %eax
movl %eax, %ecx
leaq 0xa296(%rip), %rax      # 0x12840
movb (%rax,%rcx), %al
movb %al, -0x37(%rbp)
movb -0x37(%rbp), %dl
movl $0x4e, %eax
subl -0x30(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0xa277(%rip), %rax      # 0x12840
movb %dl, (%rax,%rcx)
movb -0x37(%rbp), %dl
movl $0x4e, %eax
subl -0x30(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0xa2ab(%rip), %rax      # 0x12890
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x8596
movq -0x28(%rbp), %rdi
callq 0x40a0
movl %eax, -0x34(%rbp)
movl $0x4e, %eax
subl -0x34(%rbp), %eax
shrl %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x38(%rbp)
cmpb $0x0, -0x38(%rbp)
jne 0x8628
jmp 0x864f
movb -0x38(%rbp), %dl
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa1ff(%rip), %rax      # 0x12840
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x8613
movq -0x18(%rbp), %rdi
callq 0x40a0
movl %eax, -0x34(%rbp)
movl $0x4e, %eax
subl -0x34(%rbp), %eax
shrl %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x18(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x39(%rbp)
cmpb $0x0, -0x39(%rbp)
jne 0x8684
jmp 0x86ab
movb -0x39(%rbp), %dl
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movl %eax, %eax
movl %eax, %ecx
leaq 0xa1f3(%rip), %rax      # 0x12890
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x866f
movq 0x590e(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
leaq 0xa184(%rip), %rdi      # 0x12840
callq 0x40c0
movq 0x58f8(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
leaq 0x39aa(%rip), %rdi      # 0xc07c
callq 0x40c0
leaq 0x5c5a(%rip), %rax      # 0xe338
movl (%rax), %ecx
addl $0x3, %ecx
leaq 0x5c4e(%rip), %rax      # 0xe338
movl %ecx, (%rax)
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)