// File: /workspace/github_c_makefile_star2_O3/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 0x1494(%rip), %r15      # 0x3079
leaq 0x1474(%rip), %rbp      # 0x3060
xorl %r12d, %r12d
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1180
cmpl $0x63, %eax
jle 0x1c1b
leal -0x74(%rax), %ecx
cmpl $0x4, %ecx
ja 0x1c42
movslq (%rbp,%rcx,4), %rax
addq %rbp, %rax
jmpq *%rax
incl 0x34ff(%rip)            # 0x5118
jmp 0x1bef
cmpl $0x53, %eax
jg 0x1c33
cmpl $0x42, %eax
je 0x1c5f
cmpl $0x46, %eax
jne 0x1ca2
movb $0x2f, 0x34eb(%rip)     # 0x511c
jmp 0x1bef
cmpl $0x54, %eax
je 0x1c68
cmpl $0x61, %eax
jne 0x1cb5
incl %r13d
jmp 0x1bef
cmpl $0x64, %eax
je 0x1c7e
cmpl $0x66, %eax
jne 0x1cb5
movq 0x3385(%rip), %rax      # 0x4fd8
movq (%rax), %rax
movq %rax, 0x34c3(%rip)      # 0x5120
jmp 0x1bef
movb $0x3f, 0x34b6(%rip)     # 0x511c
jmp 0x1bef
decl 0x34aa(%rip)            # 0x5118
jmp 0x1bef
incl 0x34cb(%rip)            # 0x5144
jmp 0x1bef
incl 0x34bc(%rip)            # 0x5140
jmp 0x1bef
incl 0x34b9(%rip)            # 0x5148
incl 0x34b7(%rip)            # 0x514c
jmp 0x1bef
incl %r12d
jmp 0x1bef
cmpl $-0x1, %eax
jne 0x1cb5
movq 0x3322(%rip), %rax      # 0x4fd0
movslq (%rax), %rax
subl %eax, %ebx
jne 0x1cdf
movq 0x333c(%rip), %rax      # 0x4ff8
movq (%rax), %rcx
leaq 0x13bf(%rip), %rdi      # 0x3085
movl $0x31, %esi
movl $0x1, %edx
callq 0x11b0
movl $0x1, %edi
callq 0x11a0
leaq (%r14,%rax,8), %rbp
callq 0x1e5e
movl $0x0, 0xc(%rsp)
testl %ebx, %ebx
jle 0x1d5f
movl %ebx, %r15d
xorl %r14d, %r14d
movl $0x0, 0xc(%rsp)
movq (%rbp,%r14,8), %rdi
leaq 0x14eb(%rip), %rsi      # 0x31f9
callq 0x1170
movq %rax, 0x3436(%rip)      # 0x5150
movq (%rbp,%r14,8), %rsi
testq %rax, %rax
je 0x1d41
movq %rsi, 0x342d(%rip)      # 0x5158
movq %rsi, %rdi
callq 0x1f74
movq 0x3416(%rip), %rdi      # 0x5150
callq 0x1060
jmp 0x1d57
leaq 0x13af(%rip), %rdi      # 0x30f7
xorl %eax, %eax
callq 0x1050
movl $0x1, 0xc(%rsp)
incq %r14
cmpq %r14, %r15
jne 0x1d02
movq 0x33fa(%rip), %rdi      # 0x5160
testq %rdi, %rdi
je 0x1e0e
cmpl $0x0, 0x33d6(%rip)      # 0x514c
jne 0x1e09
testl %r12d, %r12d
je 0x1dc2
testl %ebx, %ebx
jle 0x1dbf
movl %ebx, %r15d
leaq 0x10(%rsp), %r14
xorl %ebx, %ebx
movq 0x338a(%rip), %rdx      # 0x5120
movq (%rbp,%rbx,8), %rcx
movq %r14, %rdi
leaq 0x1312(%rip), %rsi      # 0x30b7
movq %rdx, %r8
xorl %eax, %eax
callq 0x1190
movq %r14, %rdi
callq 0x1070
incq %rbx
cmpq %rbx, %r15
jne 0x1d8f
incl %r13d
movq 0x3357(%rip), %rdi      # 0x5120
testl %r13d, %r13d
leaq 0x1317(%rip), %rax      # 0x30ea
leaq 0x130e(%rip), %rsi      # 0x30e8
cmoveq %rax, %rsi
callq 0x1170
movq %rax, 0x337e(%rip)      # 0x5168
testq %rax, %rax
jne 0x1e17
movq 0x332a(%rip), %rdx      # 0x5120
leaq 0x12fa(%rip), %rsi      # 0x30f7
movl $0x1, %edi
xorl %eax, %eax
callq 0x1130
callq 0x2806
movl 0xc(%rsp), %edi
callq 0x11a0
movq 0x3342(%rip), %rdi      # 0x5160
callq 0x2806
movq 0x333e(%rip), %rdi      # 0x5168
callq 0x1060
testl %r12d, %r12d
je 0x1e0e
movq 0x32e5(%rip), %rcx      # 0x5120
leaq 0x12aa(%rip), %rsi      # 0x30ec
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rcx, %rdx
xorl %eax, %eax
callq 0x1190
movq %rbx, %rdi
callq 0x1070
jmp 0x1e0e