// File: /workspace/github_c_makefile_star2_O1/darwin-on-arm[P]darwin-sdk/developer_cmds/ctags/ctags.c
// Function: main
int
main(argc, argv)
	int	argc;
	char	**argv;
{
	static char	*outfile = "tags";	/* output file */
	int	aflag;				/* -a: append to tags */
	int	uflag;				/* -u: update tags */
	int	exit_val;			/* exit value */
	int	step;				/* step through args */
	int	ch;				/* getopts char */
	char	cmd[100];			/* too ugly to explain */

	aflag = uflag = NO;
	while ((ch = getopt(argc, argv, "BFadf:tuwvx")) != -1)
		switch(ch) {
		case 'B':
			searchar = '?';
			break;
		case 'F':
			searchar = '/';
			break;
		case 'a':
			aflag++;
			break;
		case 'd':
			dflag++;
			break;
		case 'f':
			outfile = optarg;
			break;
		case 't':
			tflag++;
			break;
		case 'T':
			tflag--;
			break;
		case 'u':
			uflag++;
			break;
		case 'w':
			wflag++;
			break;
		case 'v':
			vflag++;
		case 'x':
			xflag++;
			break;
		case '?':
		default:
			goto usage;
		}
	argv += optind;
	argc -= optind;
	if (!argc) {
usage:		(void)fprintf(stderr,
			"usage: ctags [-BFadtuwvx] [-f tagsfile] file ...\n");
		exit(1);
	}

	init();

	for (exit_val = step = 0; step < argc; ++step)
		if (!(inf = fopen(argv[step], "r"))) {
			warn("%s", argv[step]);
			exit_val = 1;
		}
		else {
			curfile = argv[step];
			find_entries(argv[step]);
			(void)fclose(inf);
		}

	if (head) {
		if (xflag)
			put_entries(head);
		else {
			if (uflag) {
				for (step = 0; step < argc; step++) {
					(void)sprintf(cmd,
						"mv %s OTAGS; fgrep -v '\t%s\t' OTAGS >%s; rm OTAGS",
							outfile, argv[step],
							outfile);
					(void)system(cmd);
				}
				++aflag;
			}
			if (!(outf = fopen(outfile, aflag ? "a" : "w")))
				err(exit_val ? exit_val : 1, "%s", outfile);
			put_entries(head);
			(void)fclose(outf);
			if (uflag) {
				(void)sprintf(cmd, "sort -o %s %s",
						outfile, outfile);
				(void)system(cmd);
			}
		}
	}
	exit(exit_val);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movl %edi, %ebx
xorl %r13d, %r13d
leaq 0x246c(%rip), %r15      # 0x4079
leaq 0x244c(%rip), %rbp      # 0x4060
xorl %r12d, %r12d
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1180
cmpl $0x63, %eax
jle 0x1c43
leal -0x74(%rax), %ecx
cmpl $0x4, %ecx
ja 0x1c6a
movslq (%rbp,%rcx,4), %rax
addq %rbp, %rax
jmpq *%rax
incl 0x44d7(%rip)            # 0x6118
jmp 0x1c17
cmpl $0x53, %eax
jg 0x1c5b
cmpl $0x42, %eax
je 0x1c87
cmpl $0x46, %eax
jne 0x1cca
movb $0x2f, 0x44c3(%rip)     # 0x611c
jmp 0x1c17
cmpl $0x54, %eax
je 0x1c90
cmpl $0x61, %eax
jne 0x1cdd
incl %r13d
jmp 0x1c17
cmpl $0x64, %eax
je 0x1ca6
cmpl $0x66, %eax
jne 0x1cdd
movq 0x435d(%rip), %rax      # 0x5fd8
movq (%rax), %rax
movq %rax, 0x449b(%rip)      # 0x6120
jmp 0x1c17
movb $0x3f, 0x448e(%rip)     # 0x611c
jmp 0x1c17
decl 0x4482(%rip)            # 0x6118
jmp 0x1c17
incl 0x44a3(%rip)            # 0x6144
jmp 0x1c17
incl 0x4494(%rip)            # 0x6140
jmp 0x1c17
incl 0x4491(%rip)            # 0x6148
incl 0x448f(%rip)            # 0x614c
jmp 0x1c17
incl %r12d
jmp 0x1c17
cmpl $-0x1, %eax
jne 0x1cdd
movq 0x42fa(%rip), %rax      # 0x5fd0
movslq (%rax), %rax
subl %eax, %ebx
jne 0x1d07
movq 0x4314(%rip), %rax      # 0x5ff8
movq (%rax), %rcx
leaq 0x2397(%rip), %rdi      # 0x4085
movl $0x31, %esi
movl $0x1, %edx
callq 0x11b0
movl $0x1, %edi
callq 0x11a0
leaq (%r14,%rax,8), %rbp
callq 0x1e88
movl $0x0, 0xc(%rsp)
testl %ebx, %ebx
jle 0x1d89
movl %ebx, %r15d
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
movq (%rbp,%r14,8), %rdi
leaq 0x24c7(%rip), %rsi      # 0x41fd
callq 0x1170
movq %rax, 0x440e(%rip)      # 0x6150
movq (%rbp,%r14,8), %rsi
testq %rax, %rax
je 0x1d6b
movq %rsi, 0x4405(%rip)      # 0x6158
movq (%rbp,%r14,8), %rdi
callq 0x1fb8
movq 0x43ec(%rip), %rdi      # 0x6150
callq 0x1060
jmp 0x1d81
leaq 0x2385(%rip), %rdi      # 0x40f7
xorl %eax, %eax
callq 0x1050
movl $0x1, 0xc(%rsp)
incq %r14
cmpq %r14, %r15
jne 0x1d2a
movq 0x43d0(%rip), %rdi      # 0x6160
testq %rdi, %rdi
je 0x1e38
cmpl $0x0, 0x43ac(%rip)      # 0x614c
jne 0x1e33
testl %r12d, %r12d
je 0x1dec
testl %ebx, %ebx
jle 0x1de9
movl %ebx, %r15d
leaq 0x10(%rsp), %r14
xorl %ebx, %ebx
movq 0x4360(%rip), %rdx      # 0x6120
movq (%rbp,%rbx,8), %rcx
movq %r14, %rdi
leaq 0x22e8(%rip), %rsi      # 0x40b7
movq %rdx, %r8
xorl %eax, %eax
callq 0x1190
movq %r14, %rdi
callq 0x1070
incq %rbx
cmpq %rbx, %r15
jne 0x1db9
incl %r13d
movq 0x432d(%rip), %rdi      # 0x6120
testl %r13d, %r13d
leaq 0x22ed(%rip), %rax      # 0x40ea
leaq 0x22e4(%rip), %rsi      # 0x40e8
cmoveq %rax, %rsi
callq 0x1170
movq %rax, 0x4354(%rip)      # 0x6168
testq %rax, %rax
jne 0x1e41
movq 0x4300(%rip), %rdx      # 0x6120
leaq 0x22d0(%rip), %rsi      # 0x40f7
movl $0x1, %edi
xorl %eax, %eax
callq 0x1130
callq 0x2a9a
movl 0xc(%rsp), %edi
callq 0x11a0
movq 0x4318(%rip), %rdi      # 0x6160
callq 0x2a9a
movq 0x4314(%rip), %rdi      # 0x6168
callq 0x1060
testl %r12d, %r12d
je 0x1e38
movq 0x42bb(%rip), %rcx      # 0x6120
leaq 0x2280(%rip), %rsi      # 0x40ec
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rcx, %rdx
xorl %eax, %eax
callq 0x1190
movq %rbx, %rdi
callq 0x1070
jmp 0x1e38