// File: /workspace/github_c_makefile_star2_O3/nimble-code[P]Modex/Src/modex.c
// Function: checkprx
void
checkprx(char *f)	/* pick up the arguments from a .prx file */
{	FILE *fd;
	char buf[2048];
	char *mnm, *z, *pz;

	if ((z = strstr(f, ".prx")) == NULL
	&&  (z = strstr(f, ".c")) == NULL)
		return;

	Argv[0] = "modex_prex";
	Arg_Add("-m", "");
	Arg_Add(modelname, "");
	Arg_Add("-L", "");
	Arg_Add(modelname, ".lut");

	*z = '\0';
	sprintf(buf, "%s.prx", f);
	*z = '.';	/* restore */
	if ((fd = fopen(buf, "r")) == NULL)	/* no .prx file */
	{	if (Verbose
		||  Verbose_cmds)
		{	fprintf(stderr, "modex: no prx file '%s', default rules apply\n", buf);
		}
		if (no_explicits())		/* no explicit extract command given */
		{	Arg_Add("-xe", "");	/* default model extraction of all fcts */
		}
		add_imported("_all_", "_all_", 2);	/* 1? */
		goto go_here;
	}

if (debug_io) fprintf(stderr, "Open %s -> %p\n", ".prx", fd);

	while (fgets(buf, sizeof(buf), fd))
	{
		if ((z = strstr(buf, "//")) != NULL)
		{	*z = '\0';	/* comment delimiter */
		}
		if (buf[0] == '\0')
		{	continue;
		}
		while (buf[strlen(buf)-1] == '\n'
		||     buf[strlen(buf)-1] == '\r'
		||     buf[strlen(buf)-1] == ' '
		||     buf[strlen(buf)-1] == '\t')
		{	buf[strlen(buf)-1] = '\0';
		}

		if (buf[0] != '\0' && buf[0] != '%')
			add_to_file(buf);
		else
		{	switch (buf[1]) {
			case 'A':	/* add something to the model text */
				header(modelname, ".ltl");
				incode = hasltl = inltl = 1;
				fprintf(fo, "/* added stuff */\n");
				break;
			case 'C':
				header(modelname, ".drv");
				incode = 1;
				fprintf(fo, "c_code {\n");
				break;
			case 'D':	/* after globals */
				header(modelname, ".drv");
				incode = 1;
				fprintf(fo, "c_decl {\n");
				break;
			case 'B':	/* before globals */
				header(modelname, ".b4g");
				incode = 1;
				fprintf(fo, "c_decl {\n");
				break;
			case 'F':
				Arg_Add("-b", "");
				z = &buf[2];
				while (*z == ' ' || *z == '\t')
					z++;
				Arg_Add(z, "");
				sawFile = 1;
				break;
			case 'G':	/* %GUI definitions */
				ingui = 1;
				close_file();
				break;
			case 'H':
				header(modelname, ".dfn");
				indfn = 1;
				break;
			case 'L':
				z = &buf[2];
				while (*z == ' ' || *z == '\t')
					z++;
				if (*z == '\0')
					mnm = modelname;
				else
				{	mnm = (char *) e_malloc(strlen(z)+1);
					strcpy(mnm, z);
				}
				header(mnm, ".lut");
				fprintf(fo, "# Modex %s\n", file_name);
				fprintf(fo, "%s for target <%s>\n", Banner, mnm);

				inlut  = 1;
				break;
			case 'N':
				pz = &buf[2];
				while (*pz == ' ' || *pz == '\t')
				{	pz++;
				}
				if (isdigit((int) *pz))
				{	nrprocs = atoi(pz);
				} else
				{	nrprocs = 1;
				}
				nrprocs_default = nrprocs;
				break;
			case 'O':
				z = &buf[2];
				while (*z == ' ' || *z == '\t')
					z++;
				lnkage_info = (char *) e_malloc(strlen(z)+1);
				strcpy(lnkage_info, z);
				break;
			case 'P':
				header(modelname, ".drv");
				haspml = inspn  = 1;
				break;
			case 'Q':
				z = &buf[2];
				while (*z == ' ' || *z == '\t')
					z++;
				preproc_info = (char *) e_malloc(strlen(z)+1);
				strcpy(preproc_info, z);
				break;
			case 'R':
				z = &buf[2];
				while (*z == ' ' || *z == '\t')
					z++;
				runtime = (char *) e_malloc(strlen(z)+2);
				strcpy(runtime, z);
				strcat(runtime, " ");
				break;
			case 'T':	// %T sed "s/replace/with/"
				z = &buf[2];
				while (*z == ' ' || *z == '\t')
					z++;
				add_sed(z);
				break;
			case '%':
				close_file();
				break;
			case 'X':
				hasaction = 1;
				Add_Args(&buf[2]);
				break;
			default:
				add_to_file(buf);
				break;
			}

			if (buf[1] == 'L' || buf[1] == 'H'
			||  buf[1] == 'D' || buf[1] == 'C'
			||  buf[1] == 'P')
				check_param(buf);
	}	}
if (debug_io) fprintf(stderr, "close A %p\n", fd);
	Fclose(fd);

go_here:
	mkruncmd();
	Arg_Add(file_name, "");
	if (!BldCmds(Argc, Argv))
	{	fprintf(stderr, "modex: checkprx: error in .prx file\n");
		exit(1);
	}
	if (no_explicits())
	{	new_cmd('x', "-xe", 10);
		add_imported("_all_", "_all_", 2);	/* 1? */
		if (Verbose_cmds)
		{	printf("modex: saw no explicit extraction commands -- assuming -xe\n");
	}	}

	if (fo && fo != fdrv)
	{
if (debug_io) fprintf(stderr, "close B %p\n", fo);
		Fclose(fo);
		fo = NULL;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movq %rdi, %rbx
leaq 0x198ec(%rip), %rsi     # 0x238e8
callq 0x42d0
testq %rax, %rax
jne 0xa01e
leaq 0x18058(%rip), %rsi     # 0x22065
movq %rbx, %rdi
callq 0x42d0
testq %rax, %rax
je 0xa634
movq %rax, %r14
leaq 0x198ad(%rip), %rax     # 0x238d5
movq %rax, 0x2ece1(%rip)     # 0x38d10
leaq 0x198aa(%rip), %rdi     # 0x238e0
leaq 0x1c054(%rip), %r15     # 0x26091
movq %r15, %rsi
callq 0x907b
movq 0x2c174(%rip), %rdi     # 0x361c0
movq %r15, %rsi
callq 0x907b
leaq 0x19888(%rip), %rdi     # 0x238e3
movq %r15, %rsi
callq 0x907b
movq 0x2c156(%rip), %rdi     # 0x361c0
leaq 0x1aa38(%rip), %rsi     # 0x24aa9
callq 0x907b
movb $0x0, (%r14)
leaq 0x19865(%rip), %rsi     # 0x238e6
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x42a0
movb $0x2e, (%r14)
leaq 0x1acff(%rip), %rsi     # 0x24d9b
movq %r15, %rdi
callq 0x4270
testq %rax, %rax
je 0xa521
movq %rax, %rbx
cmpl $0x0, 0x2e961(%rip)     # 0x38a18
jne 0xa646
movq %rsp, %r14
movq %r14, %rdi
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdx
callq 0x41a0
testq %rax, %rax
je 0xa50a
leaq 0x2(%rsp), %r13
leaq 0x1983c(%rip), %r12     # 0x23921
movl $0x2223, %r15d          # imm = 0x2223
movabsq $0x100002600, %rbp      # imm = 0x100002600
movq %r14, %rdi
movq %r12, %rsi
callq 0x42d0
testq %rax, %rax
je 0xa108
movb $0x0, (%rax)
cmpb $0x0, (%rsp)
je 0xa451
movq %r14, %rdi
callq 0x4110
movzbl -0x1(%rax,%r14), %ecx
cmpq $0x20, %rcx
ja 0xa133
btq %rcx, %rbp
jae 0xa133
movb $0x0, -0x1(%rsp,%rax)
jmp 0xa112
movzbl (%rsp), %eax
testl %eax, %eax
je 0xa140
cmpl $0x25, %eax
jne 0xa1a1
movzbl 0x1(%rsp), %eax
leal -0x41(%rax), %ecx
cmpl $0x17, %ecx
ja 0xa1ae
leaq 0x182d0(%rip), %rdx     # 0x22424
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x2c05c(%rip), %rdi     # 0x361c0
leaq 0x197b9(%rip), %rsi     # 0x23924
callq 0x8f1e
movb $0x1, %al
movb %al, 0x2eb68(%rip)      # 0x38ce0
movb %al, 0x2efba(%rip)      # 0x39138
movb %al, 0x2eb58(%rip)      # 0x38cdc
movq 0x2eb45(%rip), %rcx     # 0x38cd0
movl $0x12, %esi
movl $0x1, %edx
leaq 0x1978d(%rip), %rdi     # 0x23929
jmp 0xa350
movq %r14, %rdi
callq 0x9cd1
jmp 0xa451
cmpl $0x25, %eax
je 0xa39e
movq %r14, %rdi
callq 0x9cd1
jmp 0xa436
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa1d5
cmpl $0x9, %eax
jne 0xa1da
incq %r15
jmp 0xa1c7
movq %r13, %r12
movsbq %al, %r13
callq 0x42e0
movq (%rax), %rcx
movl $0x1, %eax
testb $0x8, 0x1(%rcx,%r13,2)
je 0xa1fe
movq %r15, %rdi
callq 0x4280
movl %eax, 0x2bffc(%rip)     # 0x36200
movl %eax, 0x2bffa(%rip)     # 0x36204
movq %r12, %r13
leaq 0x1970d(%rip), %r12     # 0x23921
jmp 0xa430
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa22a
cmpl $0x9, %eax
jne 0xa22f
incq %r15
jmp 0xa21c
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6321
movq %rax, 0x2eeea(%rip)     # 0x39130
jmp 0xa3d5
movq 0x2bf6e(%rip), %rdi     # 0x361c0
leaq 0x1978f(%rip), %rsi     # 0x239e8
callq 0x8f1e
movb $0x1, 0x2ea8f(%rip)     # 0x38cf4
jmp 0xa436
movq 0x2bf4f(%rip), %rdi     # 0x361c0
leaq 0x1908c(%rip), %rsi     # 0x23304
jmp 0xa32c
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x9, %eax
je 0xa28e
cmpl $0x20, %eax
jne 0xa293
incq %r15
jmp 0xa280
testl %eax, %eax
jne 0xa48b
movq 0x2bf1e(%rip), %r13     # 0x361c0
jmp 0xa4a9
movq 0x2bf12(%rip), %rdi     # 0x361c0
leaq 0x1904f(%rip), %rsi     # 0x23304
callq 0x8f1e
movb $0x1, 0x2ea1b(%rip)     # 0x38cdc
movq 0x2ea08(%rip), %rcx     # 0x38cd0
movl $0x9, %esi
movl $0x1, %edx
leaq 0x1a097(%rip), %rdi     # 0x24370
jmp 0xa350
leaq 0x19669(%rip), %rdi     # 0x2394b
leaq 0x1bda8(%rip), %rsi     # 0x26091
callq 0x907b
movq %r13, %rdi
movzbl (%rdi), %eax
cmpl $0x20, %eax
je 0xa2fe
cmpl $0x9, %eax
jne 0xa303
incq %rdi
jmp 0xa2f1
leaq 0x1bd87(%rip), %rsi     # 0x26091
callq 0x907b
movl $0x1, 0x2ee23(%rip)     # 0x3913c
jmp 0xa436
movq 0x2be9b(%rip), %rdi     # 0x361c0
leaq 0x1961a(%rip), %rsi     # 0x23946
callq 0x8f1e
movb $0x1, 0x2e9a4(%rip)     # 0x38cdc
movq 0x2e991(%rip), %rcx     # 0x38cd0
movl $0x9, %esi
movl $0x1, %edx
leaq 0x195ec(%rip), %rdi     # 0x2393c
callq 0x42c0
jmp 0xa436
movq 0x2be5f(%rip), %rdi     # 0x361c0
leaq 0x18f9c(%rip), %rsi     # 0x23304
callq 0x8f1e
movb $0x1, %al
movb %al, 0x2e983(%rip)      # 0x38cf8
movb %al, 0x2edc5(%rip)      # 0x39140
jmp 0xa436
movl $0x1, 0x2e6da(%rip)     # 0x38a64
movq %r13, %rdi
callq 0x913e
jmp 0xa436
movb $0x1, 0x2e952(%rip)     # 0x38cf0
callq 0x9dad
jmp 0xa436
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa3b9
cmpl $0x9, %eax
jne 0xa3be
incq %r15
jmp 0xa3ab
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6321
movq %rax, 0x2bdf3(%rip)     # 0x361c8
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
jmp 0xa430
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa3f3
cmpl $0x9, %eax
jne 0xa3f8
incq %r15
jmp 0xa3e5
movq %r15, %rdi
callq 0x4110
leal 0x2(%rax), %edi
callq 0x6321
movq %rax, 0x2bdc1(%rip)     # 0x361d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
movq 0x2bdaf(%rip), %r15     # 0x361d0
movq %r15, %rdi
callq 0x4110
movw $0x20, (%r15,%rax)
movl $0x2223, %r15d          # imm = 0x2223
movzbl 0x1(%rsp), %eax
addl $-0x43, %eax
cmpl $0xd, %eax
ja 0xa451
btl %eax, %r15d
jae 0xa451
movq %r14, %rdi
callq 0x9e4b
movq %r14, %rdi
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdx
callq 0x41a0
testq %rax, %rax
jne 0xa0f5
jmp 0xa50a
movq %r13, %rdi
movzbl (%rdi), %eax
cmpl $0x20, %eax
je 0xa47f
cmpl $0x9, %eax
jne 0xa484
incq %rdi
jmp 0xa472
callq 0x9f5d
jmp 0xa436
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6321
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
movl $0x2223, %r15d          # imm = 0x2223
movq %r13, %rdi
leaq 0x1a5f0(%rip), %rsi     # 0x24aa9
callq 0x8f1e
movq 0x2e80b(%rip), %rdi     # 0x38cd0
movq 0x2e5bc(%rip), %rdx     # 0x38a88
leaq 0x1947b(%rip), %rsi     # 0x2394e
xorl %eax, %eax
callq 0x41d0
movq 0x2e7ef(%rip), %rdi     # 0x38cd0
leaq 0x19472(%rip), %rsi     # 0x2395a
leaq 0x1947f(%rip), %rdx     # 0x2396e
movq %r13, %rcx
xorl %eax, %eax
callq 0x41d0
movb $0x1, 0x2e7fc(%rip)     # 0x38cfc
leaq 0x2(%rsp), %r13
jmp 0xa436
cmpl $0x0, 0x2e507(%rip)     # 0x38a18
jne 0xa66d
movq %rbx, %rdi
callq 0x77d0
jmp 0xa57a
movl 0x2e4f5(%rip), %eax     # 0x38a1c
orl 0x2e54f(%rip), %eax     # 0x38a7c
jne 0xa6b1
cmpl $0x0, 0x2e52a(%rip)     # 0x38a64
jne 0xa566
movq 0x2bc65(%rip), %rdi     # 0x361a8
leaq 0x1a061(%rip), %rsi     # 0x245ab
callq 0x41c0
testl %eax, %eax
jne 0xa566
leaq 0x19643(%rip), %rdi     # 0x23b9d
leaq 0x1bb30(%rip), %rsi     # 0x26091
callq 0x907b
leaq 0x193ae(%rip), %rdi     # 0x2391b
movq %rdi, %rsi
movl $0x2, %edx
callq 0xf3d0
callq 0x93c3
movq 0x2e502(%rip), %rdi     # 0x38a88
leaq 0x1bb04(%rip), %rsi     # 0x26091
callq 0x907b
movl 0x2bc80(%rip), %edi     # 0x36218
leaq 0x2e771(%rip), %rsi     # 0x38d10
callq 0x7fb2
cmpl $0x0, 0x2e4b9(%rip)     # 0x38a64
jne 0xa603
movq 0x2bbf4(%rip), %rdi     # 0x361a8
leaq 0x19ff0(%rip), %rsi     # 0x245ab
callq 0x41c0
testl %eax, %eax
jne 0xa603
leaq 0x195d2(%rip), %rsi     # 0x23b9d
movl $0x78, %edi
movl $0xa, %edx
callq 0x7e6f
leaq 0x1933a(%rip), %rdi     # 0x2391b
movq %rdi, %rsi
movl $0x2, %edx
callq 0xf3d0
cmpl $0x0, 0x2e427(%rip)     # 0x38a1c
je 0xa603
leaq 0x19568(%rip), %rdi     # 0x23b66
callq 0x40d0
movq 0x2e6c6(%rip), %rdx     # 0x38cd0
testq %rdx, %rdx
je 0xa634
cmpq 0x2e6d2(%rip), %rdx     # 0x38ce8
je 0xa634
cmpl $0x0, 0x2e3f9(%rip)     # 0x38a18
jne 0xa68d
movq %rdx, %rdi
callq 0x77d0
movq $0x0, 0x2e69c(%rip) # 0x38cd0
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b9ab(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
leaq 0x18c92(%rip), %rsi     # 0x232e9
leaq 0x1928a(%rip), %rdx     # 0x238e8
movq %rbx, %rcx
xorl %eax, %eax
callq 0x41d0
jmp 0xa0bd
movq 0x2b984(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
leaq 0x19305(%rip), %rsi     # 0x23983
movq %rbx, %rdx
xorl %eax, %eax
callq 0x41d0
jmp 0xa517
movq 0x2b964(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
leaq 0x192f1(%rip), %rsi     # 0x2398f
xorl %eax, %eax
callq 0x41d0
movq 0x2e624(%rip), %rdx     # 0x38cd0
jmp 0xa621
movq 0x2b940(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
leaq 0x1922b(%rip), %rsi     # 0x238ed
movq %rsp, %rdx
xorl %eax, %eax
callq 0x41d0
jmp 0xa533