// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x128(%rbp)
leaq 0x2a639(%rip), %rax     # 0x34c54
movq %rax, 0x3d636(%rip)     # 0x47c58
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x7410
cmpl $0x0, %eax
jne 0xa63f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x6d60
movq 0x3ab1a(%rip), %rsi     # 0x45160
leaq 0x2b01c(%rip), %rdi     # 0x35669
movb $0x0, %al
callq 0x4120
cmpl $0x0, 0x3d5ad(%rip)     # 0x47c08
je 0xa666
cmpl $0x0, 0x3d5c4(%rip)     # 0x47c28
je 0xa686
cmpl $0x0, 0x3d59f(%rip)     # 0x47c0c
jne 0xa686
cmpl $0x0, 0x3d58e(%rip)     # 0x47c04
jne 0xa686
movq 0x3d5d9(%rip), %rdi     # 0x47c58
callq 0x9ae0
jmp 0xa69c
movl $0x78, %edi
leaq 0x2ce2c(%rip), %rsi     # 0x374be
movl $0x4, %edx
callq 0x7230
cmpl $0x0, 0x3dc69(%rip)     # 0x4830c
jne 0xa7bd
movq 0x3d5a8(%rip), %rdi     # 0x47c58
leaq 0x2a385(%rip), %rsi     # 0x34a3c
callq 0x4280
movq %rax, -0x130(%rbp)
cmpq $0x0, %rax
je 0xa7bb
movq -0x130(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x130(%rbp)
movb $0x63, (%rax)
movq -0x130(%rbp), %rax
movb $0x0, (%rax)
movq 0x3d550(%rip), %rdi     # 0x47c58
leaq 0x2b994(%rip), %rsi     # 0x360a3
callq 0x4230
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xa77a
cmpl $0x0, 0x3d4c3(%rip)     # 0x47be8
je 0xa74a
movq 0x3a8ca(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movq 0x3d520(%rip), %rdx     # 0x47c58
movq -0x18(%rbp), %rcx
leaq 0x29cda(%rip), %rsi     # 0x3441d
movb $0x0, %al
callq 0x4190
movq -0x18(%rbp), %rdi
callq 0x6d20
cmpl $0x0, 0x3d492(%rip)     # 0x47bec
je 0xa76a
leaq 0x2a493(%rip), %rdi     # 0x34bf6
movb $0x0, %al
callq 0x4120
movq 0x3d4e7(%rip), %rdi     # 0x47c58
xorl %esi, %esi
callq 0x84a0
jmp 0xa799
movq 0x3d4d7(%rip), %rsi     # 0x47c58
leaq 0x2a492(%rip), %rdi     # 0x34c1a
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x4270
movq -0x130(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x130(%rbp)
movb $0x72, (%rax)
movq -0x130(%rbp), %rax
movb $0x70, (%rax)
jmp 0xa7bd
movq 0x3d494(%rip), %rsi     # 0x47c58
leaq 0x3db55(%rip), %rdi     # 0x48320
callq 0x40a0
movq 0x3d481(%rip), %rdi     # 0x47c58
leaq 0x2a476(%rip), %rsi     # 0x34c54
callq 0x4180
cmpl $0x0, %eax
je 0xa80f
movq 0x3d469(%rip), %rdi     # 0x47c58
leaq 0x2a246(%rip), %rsi     # 0x34a3c
callq 0x4280
cmpq $0x0, %rax
jne 0xa80f
movq 0x3d450(%rip), %rdi     # 0x47c58
xorl %esi, %esi
callq 0x84a0
cmpl $0x0, 0x3d3ee(%rip)     # 0x47c04
je 0xa82b
movq 0x3dd09(%rip), %rdi     # 0x48528
callq 0x326b0
xorl %edi, %edi
callq 0x4270
jmp 0xa82d
callq 0x7f10
cmpl $0x0, %eax
je 0xaa5c
cmpl $0x0, 0x3d3c6(%rip)     # 0x47c08
je 0xa9d0
cmpl $0x0, 0x3d3d9(%rip)     # 0x47c28
jne 0xa9d0
cmpl $0x0, 0x3d390(%rip)     # 0x47bec
je 0xa949
movq 0x3a767(%rip), %rax     # 0x44fd0
movq (%rax), %rax
movq %rax, -0x140(%rbp)
movq 0x3d3de(%rip), %rax     # 0x47c58
movq %rax, -0x138(%rbp)
cmpq $0x0, 0x3dc9f(%rip)     # 0x48528
je 0xa89f
movq 0x3dc96(%rip), %rax     # 0x48528
movq 0x8(%rax), %rax
movq %rax, -0x148(%rbp)
jmp 0xa8af
leaq 0x2a3ad(%rip), %rax     # 0x34c53
movq %rax, -0x148(%rbp)
jmp 0xa8af
movq -0x138(%rbp), %rdx
movq -0x140(%rbp), %rdi
movq -0x148(%rbp), %rcx
movl 0x3d37a(%rip), %esi     # 0x47c44
leaq 0x2cbed(%rip), %r8      # 0x374be
leaq 0x2a37e(%rip), %rax     # 0x34c56
cmpl $0x0, %esi
cmovneq %rax, %r8
movl 0x3d363(%rip), %esi     # 0x47c48
leaq 0x2cbd2(%rip), %r9      # 0x374be
leaq 0x2a369(%rip), %rax     # 0x34c5c
cmpl $0x0, %esi
cmovneq %rax, %r9
movl 0x3d340(%rip), %esi     # 0x47c40
leaq 0x2cbb7(%rip), %r10     # 0x374be
leaq 0x2a355(%rip), %rax     # 0x34c63
cmpl $0x0, %esi
cmovneq %rax, %r10
movl 0x3d320(%rip), %r11d    # 0x47c3c
leaq 0x2cb9b(%rip), %rax     # 0x374be
leaq 0x2a340(%rip), %rsi     # 0x34c6a
cmpl $0x0, %r11d
cmovneq %rsi, %rax
leaq 0x2a2fd(%rip), %rsi     # 0x34c36
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x4190
cmpl $0x0, 0x3d2f4(%rip)     # 0x47c44
je 0xa961
movq 0x3a677(%rip), %rax     # 0x44fd0
movq (%rax), %rdi
callq 0x2e3d0
cmpl $0x0, 0x3d2e0(%rip)     # 0x47c48
je 0xa984
movq 0x3dbaf(%rip), %rax     # 0x48520
movq 0x10(%rax), %rdi
movq 0x3a654(%rip), %rax     # 0x44fd0
movq (%rax), %rsi
callq 0x6520
cmpl $0x0, 0x3d2b5(%rip)     # 0x47c40
je 0xa992
callq 0x2d6a0
cmpl $0x0, 0x3d2a3(%rip)     # 0x47c3c
je 0xa9b1
movq 0x3db86(%rip), %rdi     # 0x48528
movq 0x3a627(%rip), %rax     # 0x44fd0
movq (%rax), %rsi
callq 0x31780
movq 0x3a618(%rip), %rax     # 0x44fd0
movq (%rax), %rdi
leaq 0x2b095(%rip), %rsi     # 0x35a57
movb $0x0, %al
callq 0x4190
xorl %edi, %edi
callq 0x4270
cmpq $0x0, 0x3db48(%rip)     # 0x48520
je 0xa9f7
movq 0x3db3f(%rip), %rax     # 0x48520
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq 0x3a5e1(%rip), %rax     # 0x44fd0
movq (%rax), %rsi
callq 0x6640
movq 0x3db2a(%rip), %rdi     # 0x48528
movq 0x3a77b(%rip), %rsi     # 0x45180
callq 0x17590
cmpq $0x0, -0x128(%rbp)
je 0xaa49
movq 0x3db05(%rip), %rax     # 0x48520
cmpq -0x128(%rbp), %rax
je 0xaa49
movq -0x128(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0xaa49
movq -0x128(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rsi
xorl %edx, %edx
movl %edx, %edi
callq 0x10590
movq 0x3dad0(%rip), %rax     # 0x48520
movq %rax, -0x128(%rbp)
jmp 0xa82d
cmpl $0x0, 0x3d429(%rip)     # 0x47e8c
je 0xaa74
movq 0x3a564(%rip), %rax     # 0x44fd0
movq (%rax), %rdi
callq 0x12650
cmpq $0x0, 0x3daa4(%rip)     # 0x48520
je 0xaaa8
movq 0x3da9b(%rip), %rax     # 0x48520
cmpq $0x0, 0x10(%rax)
je 0xaaa8
movq 0x3da8d(%rip), %rax     # 0x48520
movq 0x10(%rax), %rax
movq (%rax), %rsi
xorl %edi, %edi
movl $0x1, %edx
callq 0x10590
jmp 0xaab8
xorl %edi, %edi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x10590
cmpl $0x0, 0x3d411(%rip)     # 0x47ed0
je 0xaaca
cmpl $0x0, 0x3d848(%rip)     # 0x48310
jne 0xab09
movq 0x3a6bf(%rip), %rdi     # 0x45190
leaq 0x29960(%rip), %rsi     # 0x34438
callq 0x88c0
movq 0x3d3d4(%rip), %rdi     # 0x47eb8
callq 0x10fc0
cmpl $0x0, 0x3d818(%rip)     # 0x48308
je 0xab07
movq 0x3d3bf(%rip), %rdi     # 0x47eb8
leaq 0x2a171(%rip), %rsi     # 0x34c71
movb $0x0, %al
callq 0x4190
jmp 0xab40
cmpl $0x0, 0x3d358(%rip)     # 0x47e68
jne 0xab3e
movq 0x3d39f(%rip), %rdi     # 0x47eb8
callq 0x10fc0
cmpl $0x0, 0x3d7e3(%rip)     # 0x48308
je 0xab3c
movq 0x3d38a(%rip), %rdi     # 0x47eb8
leaq 0x2a13c(%rip), %rsi     # 0x34c71
movb $0x0, %al
callq 0x4190
jmp 0xab3e
jmp 0xab40
cmpq $0x0, 0x3d370(%rip)     # 0x47eb8
je 0xab7e
cmpl $0x0, 0x3d097(%rip)     # 0x47be8
je 0xab72
movq 0x3a49e(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
movq 0x3d354(%rip), %rdx     # 0x47eb8
leaq 0x2a11e(%rip), %rsi     # 0x34c89
movb $0x0, %al
callq 0x4190
movq 0x3d33f(%rip), %rdi     # 0x47eb8
callq 0x6d20
cmpl $0x0, 0x3d0c7(%rip)     # 0x47c4c
jne 0xaba2
cmpl $0x0, 0x3d0c2(%rip)     # 0x47c50
jne 0xaba2
cmpl $0x0, 0x3d055(%rip)     # 0x47bec
jne 0xaba2
cmpl $0x0, 0x3d2dc(%rip)     # 0x47e7c
je 0xabae
leaq 0x29b0c(%rip), %rdi     # 0x346b5
callq 0x10500
movq 0x3a443(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
callq 0x10db0
callq 0x17530
cmpl $0x0, 0x3d083(%rip)     # 0x47c4c
jne 0xabe6
cmpl $0x0, 0x3d01a(%rip)     # 0x47bec
jne 0xabe6
cmpl $0x0, 0x3d075(%rip)     # 0x47c50
jne 0xabe6
cmpl $0x0, 0x3d298(%rip)     # 0x47e7c
je 0xac2b
movq 0x3a40b(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
leaq 0x2a09e(%rip), %rsi     # 0x34c95
movb $0x0, %al
callq 0x4190
leaq -0x120(%rbp), %rdi
leaq 0x2a09e(%rip), %rsi     # 0x34caa
leaq 0x29d10(%rip), %rdx     # 0x34923
movb $0x0, %al
callq 0x4260
leaq -0x120(%rbp), %rdi
callq 0x4100
jmp 0xacb3
leaq -0x120(%rbp), %rdi
leaq 0x2a086(%rip), %rsi     # 0x34cbf
leaq 0x29ce3(%rip), %rdx     # 0x34923
movb $0x0, %al
callq 0x4260
leaq -0x120(%rbp), %rdi
callq 0x4100
cmpl $0x0, %eax
je 0xac70
movq 0x3a399(%rip), %rax     # 0x44ff8
movq (%rax), %rdi
leaq 0x2a06a(%rip), %rsi     # 0x34cd3
movb $0x0, %al
callq 0x4190
cmpl $0x0, 0x3cfb5(%rip)     # 0x47c2c
je 0xaca3
leaq -0x120(%rbp), %rdi
leaq 0x2a06a(%rip), %rsi     # 0x34cf1
leaq 0x29c95(%rip), %rdx     # 0x34923
movb $0x0, %al
callq 0x4260
leaq -0x120(%rbp), %rdi
callq 0x4100
jmp 0xacb1
leaq 0x2a05a(%rip), %rdi     # 0x34d04
movb $0x0, %al
callq 0x4120
jmp 0xacb3
xorl %edi, %edi
callq 0x4270
nopw (%rax,%rax)