// File: /workspace/github_c_makefile_star2_O2/nimble-code[P]Modex/Src/modex.c
// Function: main
int
main(int argc, char **argv)
{	FILE *fd;
	char cmd[256];

	context_t *o_ctx = NULL;

	file_name = "-";			/* default only */

	if (!BldCmds(argc,argv))		/* sets file_name */
	{	Usage(argv[0]);			/* command-line options */
	}

	printf("%s\n", VERSION);

	if ((!do_dflow || du_mode) && !preview && !predot)
	{	checkprx(file_name);		/* prx file options */
	} else
	{	new_cmd('x', "", 4);
	}

	if (!sawFile)				/* no %F command in prx file */
	{	char *z;
		if ((z = strstr(file_name, ".prx")) != NULL)
		{	z++; *z++ = 'c'; *z = '\0';	/* default .c */
			if ((fd = fopen(file_name, "r")) != NULL)
			{
if (debug_io) fprintf(stderr, "Open %s -> %p\n", file_name, fd);
				Fclose(fd);
				if (Verbose_cmds)
				{	printf("-- saw no %%F commands in prx file\n");
				}
				process_input(file_name, 0);
			} else
			{	printf("modex: warning: no file %s\n", file_name);
				exit(1);
			}
			*z-- = 'r'; *z = 'p';		/* restore */
	}	}

	strcpy(cur_in, file_name);

	if (strcmp(file_name, "-") != 0
	&&  strstr(file_name, ".prx") == NULL)
	{	process_input(file_name, 0);	/* parses file */
	}

	if (predot)
	{	dot_start(parse_tree);		/* ps_graph.c */
		exit(0);
	}

	/* model extraction functionality: */

	while (ActCmds())
	{	if (do_dflow && !du_mode)
		{	if (Verbose_cmds)
			fprintf(stdout, "/*** %s :: %s %s%s%s%s***/\n\n",
				file_name,
				parse_tree?parse_tree->hdr.fnm:"--",
				show_funcs?"+fcs ":"",
				show_syms?"+syms ":"",
				show_deps?"+deps ":"",
				show_code?"+code ":"");

			if (show_funcs)	show_fbase(stdout);
			if (show_syms)	show_symtab(contxt->syms, stdout);
			if (show_deps)	dep_show();
			if (show_code)  print_tree(parse_tree, stdout);
			fprintf(stdout, "\n");
			exit(0);
		} else
		{	if (0) fprintf(stderr, "Act %d %d -- %s\n", extended, flike, want);
			if (contxt)
			save_fcts(contxt->syms->root, stdout);
			modex_tree(parse_tree, lutt);	/* xtract.c */

			// call do_globals here to avoid losing the info
			// if a different file is parsed next
			if (o_ctx != NULL && contxt != o_ctx && o_ctx->syms)
			{	do_globals(0, o_ctx->syms->root, 0);
			}
			o_ctx = contxt;
	}	}

	if (redundancies)
	{	notimported(stdout);
	}

	if (contxt && contxt->syms)
	{	do_globals(0, contxt->syms->root, 1);
	} else
	{	do_globals(0, (scopetab_t *) 0, 1);
	}

	if (!hasdrv || !haspml)
	{	header(modelname, ".drv");
		def_inc_spn(fdrv);
		if (hasltl) fprintf(fdrv, "#include \"_modex_.ltl\"\n");
	} else if (!anybody) /* added Oct 20, 2012 */
	{	def_inc_spn(fdrv);
		if (hasltl) fprintf(fdrv, "#include \"_modex_.ltl\"\n");
	}

	if (fdrv)
	{
if (debug_io) fprintf(stderr, "close C %p\n", fdrv);
		Fclose(fdrv);
	}

	if (Verbose || Warnings || Verbose_cmds || new_lut)
	{	add_fnm("_modex_.run");
	}

	spitnames(stderr);
	alldone();

	if (Verbose || Verbose_cmds || Warnings || new_lut)
	{	fprintf(stderr, "./_modex_.run pprep\n");
		sprintf(cmd, "%s _modex_.run pprep", SH);
		system(cmd); /* preserve temp files */
	} else
	{	sprintf(cmd, "%s _modex_.run prep", SH);
		if (system(cmd) != 0)
		{	fprintf(stderr, "modex: model creation failed\n");
		}
		if (tagrun)
		{	sprintf(cmd, "%s _modex_.run run", SH);
			system(cmd);
		} else
		{	printf("created: model and _modex_.run\n");
	}	}
	exit(0);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0x19371(%rip), %rax     # 0x21a9b
movq %rax, 0x2e357(%rip)     # 0x36a88
callq 0x610a
movq 0x2ba53(%rip), %rdi     # 0x34190
callq 0x40d0
cmpl $0x0, 0x2e2ef(%rip)     # 0x36a38
setne %al
cmpl $0x0, 0x2e305(%rip)     # 0x36a58
sete %cl
testb %cl, %al
jne 0x877a
cmpl $0x0, 0x2e2db(%rip)     # 0x36a3c
jne 0x877a
cmpl $0x0, 0x2e2ca(%rip)     # 0x36a34
jne 0x877a
movq 0x2e315(%rip), %rdi     # 0x36a88
callq 0x8093
jmp 0x878c
leaq 0x1b810(%rip), %rsi     # 0x23f91
pushq $0x78
popq %rdi
pushq $0x4
popq %rdx
callq 0x5fb8
cmpl $0x0, 0x2e9a9(%rip)     # 0x3713c
movq 0x2e2ee(%rip), %r14     # 0x36a88
jne 0x885e
leaq 0x19141(%rip), %rsi     # 0x218e8
movq %r14, %rdi
callq 0x42d0
testq %rax, %rax
je 0x885e
movq %rax, %rbx
movw $0x63, 0x1(%rax)
movq 0x2e2c0(%rip), %rdi     # 0x36a88
leaq 0x1a4cc(%rip), %rsi     # 0x22c9b
callq 0x4270
testq %rax, %rax
jne 0x87f6
movq 0x2e2a8(%rip), %rsi     # 0x36a88
leaq 0x1927a(%rip), %rdi     # 0x21a61
xorl %eax, %eax
callq 0x4140
pushq $0x1
popq %rdi
callq 0x42b0
movq %rax, %r14
cmpl $0x0, 0x2e218(%rip)     # 0x36a18
je 0x8824
movq 0x2b7ef(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
movq 0x2e275(%rip), %rdx     # 0x36a88
leaq 0x18acf(%rip), %rsi     # 0x212e9
movq %r14, %rcx
xorl %eax, %eax
callq 0x41c0
movq %r14, %rdi
callq 0x59e0
cmpl $0x0, 0x2e1e9(%rip)     # 0x36a1c
je 0x8843
leaq 0x19201(%rip), %rdi     # 0x21a3d
xorl %eax, %eax
callq 0x4140
movq 0x2e23e(%rip), %rdi     # 0x36a88
xorl %esi, %esi
callq 0x6c59
movw $0x7270, 0x1(%rbx)      # imm = 0x7270
movq 0x2e22a(%rip), %r14     # 0x36a88
leaq 0x2e8eb(%rip), %rdi     # 0x37150
movq %r14, %rsi
callq 0x40b0
cmpb $0x2d, (%r14)
jne 0x887a
cmpb $0x0, 0x1(%r14)
je 0x8898
leaq 0x19067(%rip), %rsi     # 0x218e8
movq %r14, %rdi
callq 0x42d0
testq %rax, %rax
jne 0x8898
movq %r14, %rdi
xorl %esi, %esi
callq 0x6c59
cmpl $0x0, 0x2e195(%rip)     # 0x36a34
jne 0x893a
xorl %eax, %eax
movq 0x2b722(%rip), %rbx     # 0x33fd0
movq %rax, %r14
callq 0x6853
testl %eax, %eax
je 0x894b
cmpl $0x0, 0x2e173(%rip)     # 0x36a38
je 0x88d4
cmpl $0x0, 0x2e18a(%rip)     # 0x36a58
je 0x8975
movq 0x2ea75(%rip), %rax     # 0x37350
testq %rax, %rax
je 0x88ef
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq (%rbx), %rsi
callq 0x5607
movq 0x2ea62(%rip), %rdi     # 0x37358
movq 0x2b8b3(%rip), %rsi     # 0x341b0
callq 0x128fe
testq %r14, %r14
sete %cl
movq 0x2ea41(%rip), %rax     # 0x37350
cmpq %r14, %rax
sete %dl
orb %cl, %dl
jne 0x88ae
movq 0x10(%r14), %rcx
testq %rcx, %rcx
je 0x88ae
movq (%rcx), %rsi
xorl %edi, %edi
xorl %edx, %edx
callq 0xcbeb
movq 0x2ea1b(%rip), %rax     # 0x37350
jmp 0x88ae
movq 0x2ea17(%rip), %rdi     # 0x37358
callq 0x1f859
jmp 0x8bd2
cmpl $0x0, 0x2e36a(%rip)     # 0x36cbc
je 0x895c
movq (%rbx), %rdi
callq 0xe3ea
movq 0x2e9ed(%rip), %rax     # 0x37350
testq %rax, %rax
je 0x8971
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x89a8
xorl %esi, %esi
jmp 0x89ab
cmpl $0x0, 0x2e0a0(%rip)     # 0x36a1c
je 0x8b74
movq (%rbx), %rdi
movq 0x2e0fc(%rip), %rdx     # 0x36a88
movq 0x2e9c5(%rip), %rax     # 0x37358
testq %rax, %rax
jne 0x8b0d
leaq 0x190f7(%rip), %rcx     # 0x21a9a
jmp 0x8b11
movq (%rax), %rsi
pushq $0x1
popq %rdx
xorl %edi, %edi
callq 0xcbeb
cmpb $0x1, 0x2e344(%rip)     # 0x36d00
jne 0x89e7
testb $0x1, 0x2e77b(%rip)     # 0x37140
je 0x89e7
cmpl $0x0, 0x2e2ca(%rip)     # 0x36c98
jne 0x8a28
movq 0x2e311(%rip), %rdi     # 0x36ce8
callq 0xd3d8
cmpb $0x1, 0x2e755(%rip)     # 0x37138
je 0x8a0f
jmp 0x8a28
movq 0x2b7d2(%rip), %rdi     # 0x341c0
leaq 0x1890f(%rip), %rsi     # 0x21304
callq 0x7031
movq 0x2e2e7(%rip), %rdi     # 0x36ce8
callq 0xd3d8
cmpb $0x0, 0x2e72b(%rip)     # 0x37138
je 0x8a28
movq 0x2e2d2(%rip), %rcx     # 0x36ce8
leaq 0x1909b(%rip), %rdi     # 0x21ab8
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x42c0
movq 0x2e2b9(%rip), %rdx     # 0x36ce8
testq %rdx, %rdx
je 0x8a64
cmpl $0x0, 0x2dfdd(%rip)     # 0x36a18
je 0x8a5c
movq 0x2b5b4(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x19082(%rip), %rsi     # 0x21ad0
xorl %eax, %eax
callq 0x41c0
movq 0x2e28c(%rip), %rdx     # 0x36ce8
movq %rdx, %rdi
callq 0x59e0
cmpl $0x0, 0x2e011(%rip)     # 0x36a7c
jne 0x8a88
cmpl $0x0, 0x2e00c(%rip)     # 0x36a80
jne 0x8a88
cmpl $0x0, 0x2df9f(%rip)     # 0x36a1c
jne 0x8a88
cmpl $0x0, 0x2e226(%rip)     # 0x36cac
je 0x8a94
leaq 0x19125(%rip), %rdi     # 0x21bb4
callq 0xcb92
movq 0x2b55d(%rip), %r14     # 0x33ff8
movq (%r14), %rdi
callq 0xd1cc
callq 0x128af
cmpl $0x0, 0x2dfcd(%rip)     # 0x36a7c
jne 0x8ad0
cmpl $0x0, 0x2df64(%rip)     # 0x36a1c
jne 0x8ad0
cmpl $0x0, 0x2dfbf(%rip)     # 0x36a80
jne 0x8ad0
cmpl $0x0, 0x2e1e2(%rip)     # 0x36cac
je 0x8bd9
movq (%r14), %rcx
leaq 0x19002(%rip), %rdi     # 0x21adc
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
callq 0x42c0
leaq 0x19005(%rip), %rsi     # 0x21af1
leaq 0x18cf0(%rip), %rdx     # 0x217e3
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42a0
movq %rbx, %rdi
callq 0x4120
jmp 0x8bd2
movq 0x8(%rax), %rcx
cmpl $0x0, 0x2df5c(%rip)     # 0x36a74
leaq 0x1b472(%rip), %rax     # 0x23f91
leaq 0x18f77(%rip), %r8      # 0x21a9d
cmoveq %rax, %r8
cmpl $0x0, 0x2df47(%rip)     # 0x36a78
leaq 0x18f6b(%rip), %r9      # 0x21aa3
cmoveq %rax, %r9
cmpl $0x0, 0x2df2d(%rip)     # 0x36a70
leaq 0x18f60(%rip), %r10     # 0x21aaa
cmoveq %rax, %r10
cmpl $0x0, 0x2df17(%rip)     # 0x36a6c
leaq 0x18f55(%rip), %r11     # 0x21ab1
cmoveq %rax, %r11
leaq 0x18f16(%rip), %rsi     # 0x21a7d
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x41c0
popq %rcx
popq %rdx
cmpl $0x0, 0x2def9(%rip)     # 0x36a74
je 0x8b85
movq (%rbx), %rdi
callq 0x1ce25
cmpl $0x0, 0x2deec(%rip)     # 0x36a78
je 0x8ba1
movq 0x2e7bb(%rip), %rax     # 0x37350
movq 0x10(%rax), %rdi
movq (%rbx), %rsi
callq 0x5567
cmpl $0x0, 0x2dec8(%rip)     # 0x36a70
je 0x8baf
callq 0x1c604
cmpl $0x0, 0x2deb6(%rip)     # 0x36a6c
je 0x8bc7
movq 0x2e799(%rip), %rdi     # 0x37358
movq (%rbx), %rsi
callq 0x1ece2
movq (%rbx), %rsi
pushq $0xa
popq %rdi
callq 0x4180
xorl %edi, %edi
callq 0x42b0
leaq 0x18f26(%rip), %rsi     # 0x21b06
leaq 0x18bfc(%rip), %rdx     # 0x217e3
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42a0
movq %rbx, %rdi
callq 0x4120
testl %eax, %eax
je 0x8c15
movq (%r14), %rcx
leaq 0x18f10(%rip), %rdi     # 0x21b1a
pushq $0x1d
popq %rsi
pushq $0x1
popq %rdx
callq 0x42c0
cmpl $0x0, 0x2de40(%rip)     # 0x36a5c
jne 0x8c2c
leaq 0x18f7c(%rip), %rdi     # 0x21ba1
callq 0x40d0
jmp 0x8bd2
leaq 0x18f05(%rip), %rsi     # 0x21b38
jmp 0x8aec