// File: /workspace/github_c_makefile_star2_O1/ksherlock[P]nroff_man/main.c
// Function: main
int main(int argc, char **argv) {

	int i;
	int ch;

#ifdef __STACK_CHECK__
    _beginStackCheck();
    atexit(printStack);
#endif

	while (( ch = getopt(argc, argv, "m:hW:I:ibt:T:")) != -1) {
		switch(ch) {
			case '?': case ':':
			default: usage(1);
			case 'h': usage(0);
			case 'i': flags.i = 1; break;
			case 'b': flags.b = 1; break;
			case 'W':
				if (isdigit(*optarg))
					flags.W = *optarg - '0';
				else
					warnx("-W %s: Bad argument", optarg);
				break;
			case 'I':
				if (strncmp(optarg, "os=", 3) == 0)
					flags.os = optarg + 3;
				else
					warnx("-I %s: Bad argument", optarg);
				break;
			case 'm': /* silently accept -man */
				break;

			case 't':
				flags.t = optarg;
				break;
			case 'T':
				flags.T = parseT(optarg);
				if (flags.T < 0) usage(1);

				break;
		}
	}

	argc -= optind;
	argv += optind;


	if (flags.T == FMT_TERMCAP)
		tc_init();

	if (argc == 0) {
		man(stdin, "stdin");
	} else {
		for (i = 0; i < argc; ++i) {
			char *cp = argv[i];
			FILE *fp = fopen(cp, "r");
			if (!fp) err(1, "Unable to open %s", cp);
			man(fp, cp);
			fclose(fp);
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
leaq 0x4a41(%rip), %r15      # 0x9004
movq 0x9a0e(%rip), %r12      # 0xdfd8
leaq 0x9da7(%rip), %rbp      # 0xe378
movl %edi, 0x4(%rsp)
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4180
cmpl $0x61, %eax
jle 0x4607
cmpl $0x6c, %eax
jg 0x4642
cmpl $0x62, %eax
je 0x469c
cmpl $0x69, %eax
jne 0x4835
movl $0x1, 0x4(%rbp)
jmp 0x45d5
cmpl $0x53, %eax
jle 0x465d
cmpl $0x54, %eax
je 0x46a8
cmpl $0x57, %eax
jne 0x4815
callq 0x41d0
movq (%rax), %rcx
movq (%r12), %rsi
movsbq (%rsi), %rax
testb $0x8, 0x1(%rcx,%rax,2)
jne 0x4755
leaq 0x49d2(%rip), %rdi      # 0x9012
jmp 0x4690
cmpl $0x6d, %eax
je 0x45d5
cmpl $0x74, %eax
jne 0x4815
movq (%r12), %rax
movq %rax, 0x18(%rbp)
jmp 0x45d5
cmpl $0x49, %eax
jne 0x4778
movq (%r12), %r13
movl $0x3, %edx
movq %r13, %rdi
leaq 0x49ad(%rip), %rsi      # 0x9026
callq 0x4070
testl %eax, %eax
je 0x4760
leaq 0x499d(%rip), %rdi      # 0x902a
movq %r13, %rsi
xorl %eax, %eax
callq 0x40b0
jmp 0x45d5
movl $0x1, 0x8(%rbp)
jmp 0x45d5
movq %r14, %rbx
movq %r15, %r14
movq %rbp, %r15
movq (%r12), %r13
testq %r13, %r13
je 0x480d
movq %r12, %rbp
movzbl (%r13), %r12d
cmpl $0x61, %r12d
je 0x4703
cmpl $0x70, %r12d
je 0x4720
cmpl $0x74, %r12d
jne 0x480d
movq %r13, %rdi
leaq 0x4a2b(%rip), %rsi      # 0x9111
callq 0x4100
testl %eax, %eax
je 0x4774
cmpl $0x70, %r12d
je 0x4720
cmpl $0x61, %r12d
jne 0x480d
movq %r13, %rdi
leaq 0x4a0c(%rip), %rsi      # 0x9119
callq 0x4100
testl %eax, %eax
je 0x476d
cmpl $0x70, %r12d
jne 0x480d
movq %r13, %rdi
leaq 0x49f5(%rip), %rsi      # 0x911f
callq 0x4100
movl $0x2, %ecx
testl %eax, %eax
jne 0x480d
movl %ecx, 0x20(%r15)
movq %rbp, %r12
movq %r15, %rbp
movq %r14, %r15
movq %rbx, %r14
movl 0x4(%rsp), %ebx
jmp 0x45d5
addl $-0x30, %eax
movl %eax, (%rbp)
jmp 0x45d5
addq $0x3, %r13
movq %r13, 0x10(%rbp)
jmp 0x45d5
movl $0x1, %ecx
jmp 0x473c
xorl %ecx, %ecx
jmp 0x473c
cmpl $-0x1, %eax
jne 0x4815
movq 0x9848(%rip), %rax      # 0xdfd0
movslq (%rax), %r15
cmpl $0x0, 0x20(%rbp)
jne 0x4796
callq 0x6504
cmpl %r15d, %ebx
jne 0x47b3
movq 0x9826(%rip), %rax      # 0xdfc8
movq (%rax), %rdi
leaq 0x4892(%rip), %rsi      # 0x903e
callq 0x69ec
jmp 0x47fc
subl %r15d, %ebx
testl %ebx, %ebx
jle 0x47fc
leaq (%r14,%r15,8), %r12
movl %ebx, %r13d
xorl %ebp, %ebp
leaq 0x4e02(%rip), %rbx      # 0x95cc
movq (%r12,%rbp,8), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4170
testq %rax, %rax
je 0x4857
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x69ec
movq %r15, %rdi
callq 0x4090
incq %rbp
cmpq %rbp, %r13
jne 0x47ca
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, 0x20(%r15) # imm = 0xFFFFFFFF
movq 0x97a4(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
leaq 0x4830(%rip), %rdi      # 0x9056
callq 0x40c0
movl $0x1, %edi
callq 0x4190
cmpl $0x68, %eax
jne 0x4815
movq 0x977f(%rip), %rax      # 0xdfc0
movq (%rax), %rsi
leaq 0x480b(%rip), %rdi      # 0x9056
callq 0x40c0
xorl %edi, %edi
callq 0x4190
leaq 0x47e6(%rip), %rsi      # 0x9044
movl $0x1, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4130
nopl (%rax)