// File: /workspace/github_c_makefile_star2_O1/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 0x1a781(%rip), %rsi     # 0x248e8
callq 0x42c0
testq %rax, %rax
jne 0xa189
leaq 0x18eed(%rip), %rsi     # 0x23065
movq %rbx, %rdi
callq 0x42c0
testq %rax, %rax
je 0xa7a3
movq %rax, %r14
leaq 0x1a742(%rip), %rax     # 0x248d5
movq %rax, 0x2fb66(%rip)     # 0x39d00
leaq 0x1a73f(%rip), %rdi     # 0x248e0
leaq 0x1ceec(%rip), %r15     # 0x27094
movq %r15, %rsi
callq 0x9231
movq 0x2cff9(%rip), %rdi     # 0x371b0
movq %r15, %rsi
callq 0x9231
leaq 0x1a71d(%rip), %rdi     # 0x248e3
movq %r15, %rsi
callq 0x9231
movq 0x2cfdb(%rip), %rdi     # 0x371b0
leaq 0x1b8cd(%rip), %rsi     # 0x25aa9
callq 0x9231
movb $0x0, (%r14)
leaq 0x1a6fa(%rip), %rsi     # 0x248e6
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4290
movb $0x2e, (%r14)
leaq 0x1bb94(%rip), %rsi     # 0x25d9b
movq %r15, %rdi
callq 0x4260
testq %rax, %rax
je 0xa68c
movq %rax, %rbx
cmpl $0x0, 0x2f7e6(%rip)     # 0x39a08
jne 0xa7b5
movq %rsp, %r14
movq %r14, %rdi
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdx
callq 0x41a0
testq %rax, %rax
je 0xa675
leaq 0x2(%rsp), %r13
leaq 0x1a6d1(%rip), %r12     # 0x24921
movl $0x2223, %r15d          # imm = 0x2223
movabsq $0x100002600, %rbp      # imm = 0x100002600
movq %r14, %rdi
movq %r12, %rsi
callq 0x42c0
testq %rax, %rax
je 0xa273
movb $0x0, (%rax)
cmpb $0x0, (%rsp)
je 0xa5bc
movq %r14, %rdi
callq 0x4110
movzbl -0x1(%rax,%r14), %ecx
cmpq $0x20, %rcx
ja 0xa29e
btq %rcx, %rbp
jae 0xa29e
movb $0x0, -0x1(%rsp,%rax)
jmp 0xa27d
movzbl (%rsp), %eax
testl %eax, %eax
je 0xa2ab
cmpl $0x25, %eax
jne 0xa30c
movzbl 0x1(%rsp), %eax
leal -0x41(%rax), %ecx
cmpl $0x17, %ecx
ja 0xa319
leaq 0x19165(%rip), %rdx     # 0x23424
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x2cee1(%rip), %rdi     # 0x371b0
leaq 0x1a64e(%rip), %rsi     # 0x24924
callq 0x90da
movb $0x1, %al
movb %al, 0x2f9ed(%rip)      # 0x39cd0
movb %al, 0x2fe3f(%rip)      # 0x3a128
movb %al, 0x2f9dd(%rip)      # 0x39ccc
movq 0x2f9ca(%rip), %rcx     # 0x39cc0
movl $0x12, %esi
movl $0x1, %edx
leaq 0x1a622(%rip), %rdi     # 0x24929
jmp 0xa4bb
movq %r14, %rdi
callq 0x9e3f
jmp 0xa5bc
cmpl $0x25, %eax
je 0xa509
movq %r14, %rdi
callq 0x9e3f
jmp 0xa5a1
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa340
cmpl $0x9, %eax
jne 0xa345
incq %r15
jmp 0xa332
movq %r13, %r12
movsbq %al, %r13
callq 0x42d0
movq (%rax), %rcx
movl $0x1, %eax
testb $0x8, 0x1(%rcx,%r13,2)
je 0xa369
movq %r15, %rdi
callq 0x4270
movl %eax, 0x2ce81(%rip)     # 0x371f0
movl %eax, 0x2ce7f(%rip)     # 0x371f4
movq %r12, %r13
leaq 0x1a5a2(%rip), %r12     # 0x24921
jmp 0xa59b
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa395
cmpl $0x9, %eax
jne 0xa39a
incq %r15
jmp 0xa387
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6469
movq %rax, 0x2fd6f(%rip)     # 0x3a120
jmp 0xa540
movq 0x2cdf3(%rip), %rdi     # 0x371b0
leaq 0x1a624(%rip), %rsi     # 0x249e8
callq 0x90da
movb $0x1, 0x2f914(%rip)     # 0x39ce4
jmp 0xa5a1
movq 0x2cdd4(%rip), %rdi     # 0x371b0
leaq 0x19f21(%rip), %rsi     # 0x24304
jmp 0xa497
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x9, %eax
je 0xa3f9
cmpl $0x20, %eax
jne 0xa3fe
incq %r15
jmp 0xa3eb
testl %eax, %eax
jne 0xa5f6
movq 0x2cda3(%rip), %r13     # 0x371b0
jmp 0xa614
movq 0x2cd97(%rip), %rdi     # 0x371b0
leaq 0x19ee4(%rip), %rsi     # 0x24304
callq 0x90da
movb $0x1, 0x2f8a0(%rip)     # 0x39ccc
movq 0x2f88d(%rip), %rcx     # 0x39cc0
movl $0x9, %esi
movl $0x1, %edx
leaq 0x1af2c(%rip), %rdi     # 0x25370
jmp 0xa4bb
leaq 0x1a4fe(%rip), %rdi     # 0x2494b
leaq 0x1cc40(%rip), %rsi     # 0x27094
callq 0x9231
movq %r13, %rdi
movzbl (%rdi), %eax
cmpl $0x20, %eax
je 0xa469
cmpl $0x9, %eax
jne 0xa46e
incq %rdi
jmp 0xa45c
leaq 0x1cc1f(%rip), %rsi     # 0x27094
callq 0x9231
movl $0x1, 0x2fca8(%rip)     # 0x3a12c
jmp 0xa5a1
movq 0x2cd20(%rip), %rdi     # 0x371b0
leaq 0x1a4af(%rip), %rsi     # 0x24946
callq 0x90da
movb $0x1, 0x2f829(%rip)     # 0x39ccc
movq 0x2f816(%rip), %rcx     # 0x39cc0
movl $0x9, %esi
movl $0x1, %edx
leaq 0x1a481(%rip), %rdi     # 0x2493c
callq 0x42b0
jmp 0xa5a1
movq 0x2cce4(%rip), %rdi     # 0x371b0
leaq 0x19e31(%rip), %rsi     # 0x24304
callq 0x90da
movb $0x1, %al
movb %al, 0x2f808(%rip)      # 0x39ce8
movb %al, 0x2fc4a(%rip)      # 0x3a130
jmp 0xa5a1
movl $0x1, 0x2f55f(%rip)     # 0x39a54
movq %r13, %rdi
callq 0x92ed
jmp 0xa5a1
movb $0x1, 0x2f7d7(%rip)     # 0x39ce0
callq 0x9f1b
jmp 0xa5a1
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa524
cmpl $0x9, %eax
jne 0xa529
incq %r15
jmp 0xa516
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6469
movq %rax, 0x2cc78(%rip)     # 0x371b8
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
jmp 0xa59b
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0xa55e
cmpl $0x9, %eax
jne 0xa563
incq %r15
jmp 0xa550
movq %r15, %rdi
callq 0x4110
leal 0x2(%rax), %edi
callq 0x6469
movq %rax, 0x2cc46(%rip)     # 0x371c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
movq 0x2cc34(%rip), %r15     # 0x371c0
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 0xa5bc
btl %eax, %r15d
jae 0xa5bc
movq %r14, %rdi
callq 0x9fb6
movq %r14, %rdi
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdx
callq 0x41a0
testq %rax, %rax
jne 0xa260
jmp 0xa675
movq %r13, %rdi
movzbl (%rdi), %eax
cmpl $0x20, %eax
je 0xa5ea
cmpl $0x9, %eax
jne 0xa5ef
incq %rdi
jmp 0xa5dd
callq 0xa0c8
jmp 0xa5a1
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6469
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
movl $0x2223, %r15d          # imm = 0x2223
movq %r13, %rdi
leaq 0x1b485(%rip), %rsi     # 0x25aa9
callq 0x90da
movq 0x2f690(%rip), %rdi     # 0x39cc0
movq 0x2f441(%rip), %rdx     # 0x39a78
leaq 0x1a310(%rip), %rsi     # 0x2494e
xorl %eax, %eax
callq 0x41c0
movq 0x2f674(%rip), %rdi     # 0x39cc0
leaq 0x1a307(%rip), %rsi     # 0x2495a
leaq 0x1a314(%rip), %rdx     # 0x2496e
movq %r13, %rcx
xorl %eax, %eax
callq 0x41c0
movb $0x1, 0x2f681(%rip)     # 0x39cec
leaq 0x2(%rsp), %r13
jmp 0xa5a1
cmpl $0x0, 0x2f38c(%rip)     # 0x39a08
jne 0xa7dc
movq %rbx, %rdi
callq 0x793c
jmp 0xa6e5
movl 0x2f37a(%rip), %eax     # 0x39a0c
orl 0x2f3d4(%rip), %eax     # 0x39a6c
jne 0xa819
cmpl $0x0, 0x2f3af(%rip)     # 0x39a54
jne 0xa6d1
movq 0x2caea(%rip), %rdi     # 0x37198
leaq 0x1aef6(%rip), %rsi     # 0x255ab
callq 0x41b0
testl %eax, %eax
jne 0xa6d1
leaq 0x1a4d8(%rip), %rdi     # 0x24b9d
leaq 0x1c9c8(%rip), %rsi     # 0x27094
callq 0x9231
leaq 0x1a243(%rip), %rdi     # 0x2491b
movq %rdi, %rsi
movl $0x2, %edx
callq 0xf51f
callq 0x9572
movq 0x2f387(%rip), %rdi     # 0x39a78
leaq 0x1c99c(%rip), %rsi     # 0x27094
callq 0x9231
movl 0x2cb05(%rip), %edi     # 0x37208
leaq 0x2f5f6(%rip), %rsi     # 0x39d00
callq 0x8125
cmpl $0x0, 0x2f33e(%rip)     # 0x39a54
jne 0xa76e
movq 0x2ca79(%rip), %rdi     # 0x37198
leaq 0x1ae85(%rip), %rsi     # 0x255ab
callq 0x41b0
testl %eax, %eax
jne 0xa76e
leaq 0x1a467(%rip), %rsi     # 0x24b9d
movl $0x78, %edi
movl $0xa, %edx
callq 0x7fdb
leaq 0x1a1cf(%rip), %rdi     # 0x2491b
movq %rdi, %rsi
movl $0x2, %edx
callq 0xf51f
cmpl $0x0, 0x2f2ac(%rip)     # 0x39a0c
je 0xa76e
leaq 0x1a3fd(%rip), %rdi     # 0x24b66
callq 0x40d0
movq 0x2f54b(%rip), %rdx     # 0x39cc0
testq %rdx, %rdx
je 0xa7a3
cmpq 0x2f557(%rip), %rdx     # 0x39cd8
je 0xa7a3
cmpl $0x0, 0x2f27e(%rip)     # 0x39a08
jne 0xa7fc
movq 0x2f52d(%rip), %rdi     # 0x39cc0
callq 0x793c
movq $0x0, 0x2f51d(%rip) # 0x39cc0
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2c83c(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0x19b23(%rip), %rsi     # 0x242e9
leaq 0x1a11b(%rip), %rdx     # 0x248e8
movq %rbx, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0xa228
movq 0x2c815(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0x1a196(%rip), %rsi     # 0x24983
movq %rbx, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xa682
movq 0x2c7f5(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0x1a182(%rip), %rsi     # 0x2498f
xorl %eax, %eax
callq 0x41c0
jmp 0xa78c
movq 0x2c7d8(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0x1a0c3(%rip), %rsi     # 0x248ed
movq %rsp, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xa69e