// File: /workspace/github_c_makefile_star2_O2/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 0x1983a(%rip), %rsi     # 0x218e8
callq 0x42d0
testq %rax, %rax
jne 0x80d0
leaq 0x17fa6(%rip), %rsi     # 0x20065
movq %rbx, %rdi
callq 0x42d0
testq %rax, %rax
je 0x867c
movq %rax, %r15
leaq 0x197fb(%rip), %rax     # 0x218d5
movq %rax, 0x2ec2f(%rip)     # 0x36d10
leaq 0x197f8(%rip), %rdi     # 0x218e0
leaq 0x1bea2(%rip), %r14     # 0x23f91
movq %r14, %rsi
callq 0x7186
movq 0x2c0c2(%rip), %rdi     # 0x341c0
movq %r14, %rsi
callq 0x7186
leaq 0x197d6(%rip), %rdi     # 0x218e3
movq %r14, %rsi
callq 0x7186
movq 0x2c0a4(%rip), %rdi     # 0x341c0
leaq 0x1a886(%rip), %rsi     # 0x229a9
callq 0x7186
movb $0x0, (%r15)
leaq 0x197b3(%rip), %rsi     # 0x218e6
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x42a0
movb $0x2e, (%r15)
leaq 0x1ab4d(%rip), %rsi     # 0x22c9b
movq %r14, %rdi
callq 0x4270
testq %rax, %rax
je 0x85a2
movq %rax, %rbx
cmpl $0x0, 0x2e8af(%rip)     # 0x36a18
jne 0x868e
leaq 0x2(%rsp), %rbp
leaq 0x197a6(%rip), %r12     # 0x21921
movl $0x2223, %r15d          # imm = 0x2223
movabsq $0x100002600, %r13      # imm = 0x100002600
movq %r14, %rdi
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rdx
callq 0x4190
testq %rax, %rax
je 0x858b
movq %r14, %rdi
movq %r12, %rsi
callq 0x42d0
testq %rax, %rax
je 0x81b7
movb $0x0, (%rax)
cmpb $0x0, (%rsp)
je 0x818b
movq %r14, %rdi
callq 0x4110
movzbl -0x1(%rax,%r14), %ecx
cmpq $0x20, %rcx
ja 0x81de
btq %rcx, %r13
jae 0x81de
movb $0x0, -0x1(%rsp,%rax)
jmp 0x81bd
movzbl (%rsp), %eax
testl %eax, %eax
je 0x81eb
cmpl $0x25, %eax
jne 0x8244
movzbl 0x1(%rsp), %eax
leal -0x41(%rax), %ecx
cmpl $0x17, %ecx
ja 0x8251
leaq 0x18225(%rip), %rdx     # 0x20424
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x2bfb1(%rip), %rdi     # 0x341c0
leaq 0x1970e(%rip), %rsi     # 0x21924
callq 0x7031
movb $0x1, %al
movb %al, 0x2eabd(%rip)      # 0x36ce0
movb %al, 0x2ef0f(%rip)      # 0x37138
movb %al, 0x2eaad(%rip)      # 0x36cdc
movq 0x2ea9a(%rip), %rcx     # 0x36cd0
leaq 0x196ec(%rip), %rdi     # 0x21929
pushq $0x12
jmp 0x83de
movq %r14, %rdi
callq 0x7dac
jmp 0x818b
cmpl $0x25, %eax
je 0x8430
movq %r14, %rdi
callq 0x7dac
jmp 0x84c8
movq %rbp, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0x8278
cmpl $0x9, %eax
jne 0x827d
incq %r15
jmp 0x826a
movq %rbp, %r12
movsbq %al, %rbp
callq 0x42e0
movq (%rax), %rax
testb $0x8, 0x1(%rax,%rbp,2)
pushq $0x1
popq %rax
je 0x829e
movq %r15, %rdi
callq 0x4280
movl %eax, 0x2bf5c(%rip)     # 0x34200
movl %eax, 0x2bf5a(%rip)     # 0x34204
movq %r12, %rbp
leaq 0x1966d(%rip), %r12     # 0x21921
jmp 0x84c2
movq %rbp, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0x82ca
cmpl $0x9, %eax
jne 0x82cf
incq %r15
jmp 0x82bc
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x4739
movq %rax, 0x2ee4a(%rip)     # 0x37130
jmp 0x8467
movq 0x2bece(%rip), %rdi     # 0x341c0
leaq 0x196ef(%rip), %rsi     # 0x219e8
callq 0x7031
movb $0x1, 0x2e9ef(%rip)     # 0x36cf4
jmp 0x84c8
movq 0x2beaf(%rip), %rdi     # 0x341c0
leaq 0x18fec(%rip), %rsi     # 0x21304
jmp 0x83c2
movq %rbp, %r15
movzbl (%r15), %eax
cmpl $0x9, %eax
je 0x832e
cmpl $0x20, %eax
jne 0x8333
incq %r15
jmp 0x8320
testl %eax, %eax
jne 0x850c
movq 0x2be7e(%rip), %rbp     # 0x341c0
jmp 0x852a
movq 0x2be72(%rip), %rdi     # 0x341c0
leaq 0x18faf(%rip), %rsi     # 0x21304
callq 0x7031
movb $0x1, 0x2e97b(%rip)     # 0x36cdc
movq 0x2e968(%rip), %rcx     # 0x36cd0
leaq 0x19f01(%rip), %rdi     # 0x22270
jmp 0x83dc
leaq 0x195d3(%rip), %rdi     # 0x2194b
leaq 0x1bc12(%rip), %rsi     # 0x23f91
callq 0x7186
movq %rbp, %rdi
movzbl (%rdi), %eax
cmpl $0x20, %eax
je 0x8394
cmpl $0x9, %eax
jne 0x8399
incq %rdi
jmp 0x8387
leaq 0x1bbf1(%rip), %rsi     # 0x23f91
callq 0x7186
movl $0x1, 0x2ed8d(%rip)     # 0x3713c
jmp 0x84c8
movq 0x2be05(%rip), %rdi     # 0x341c0
leaq 0x19584(%rip), %rsi     # 0x21946
callq 0x7031
movb $0x1, 0x2e90e(%rip)     # 0x36cdc
movq 0x2e8fb(%rip), %rcx     # 0x36cd0
leaq 0x19560(%rip), %rdi     # 0x2193c
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
callq 0x42c0
jmp 0x84c8
movq 0x2bdcd(%rip), %rdi     # 0x341c0
leaq 0x18f0a(%rip), %rsi     # 0x21304
callq 0x7031
movb $0x1, %al
movb %al, 0x2e8f1(%rip)      # 0x36cf8
movb %al, 0x2ed33(%rip)      # 0x37140
jmp 0x84c8
movl $0x1, 0x2e648(%rip)     # 0x36a64
movq %rbp, %rdi
callq 0x7268
jmp 0x84c8
movb $0x1, 0x2e8c0(%rip)     # 0x36cf0
callq 0x7e7c
jmp 0x84c8
movq %rbp, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0x844b
cmpl $0x9, %eax
jne 0x8450
incq %r15
jmp 0x843d
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x4739
movq %rax, 0x2bd61(%rip)     # 0x341c8
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
jmp 0x84c2
movq %rbp, %r15
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0x8485
cmpl $0x9, %eax
jne 0x848a
incq %r15
jmp 0x8477
movq %r15, %rdi
callq 0x4110
leal 0x2(%rax), %edi
callq 0x4739
movq %rax, 0x2bd2f(%rip)     # 0x341d0
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
movq 0x2bd1d(%rip), %r15     # 0x341d0
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 0x818b
btl %eax, %r15d
jae 0x818b
movq %r14, %rdi
callq 0x7f13
jmp 0x818b
movq %rbp, %rdi
movzbl (%rdi), %eax
cmpl $0x20, %eax
je 0x8500
cmpl $0x9, %eax
jne 0x8505
incq %rdi
jmp 0x84f3
callq 0x800f
jmp 0x84c8
movq %r15, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x4739
movq %rax, %rbp
movq %rax, %rdi
movq %r15, %rsi
callq 0x40b0
movl $0x2223, %r15d          # imm = 0x2223
movq %rbp, %rdi
leaq 0x1a46f(%rip), %rsi     # 0x229a9
callq 0x7031
movq 0x2e78a(%rip), %rdi     # 0x36cd0
movq 0x2e53b(%rip), %rdx     # 0x36a88
leaq 0x193fa(%rip), %rsi     # 0x2194e
xorl %eax, %eax
callq 0x41c0
movq 0x2e76e(%rip), %rdi     # 0x36cd0
leaq 0x193f1(%rip), %rsi     # 0x2195a
leaq 0x193fe(%rip), %rdx     # 0x2196e
movq %rbp, %rcx
xorl %eax, %eax
callq 0x41c0
movb $0x1, 0x2e77b(%rip)     # 0x36cfc
leaq 0x2(%rsp), %rbp
jmp 0x84c8
cmpl $0x0, 0x2e486(%rip)     # 0x36a18
jne 0x86b5
movq %rbx, %rdi
callq 0x59e0
jmp 0x85e2
movl 0x2e474(%rip), %eax     # 0x36a1c
orl 0x2e4ce(%rip), %eax     # 0x36a7c
jne 0x86f9
callq 0x72dc
testl %eax, %eax
je 0x85d0
leaq 0x195d9(%rip), %rdi     # 0x21b9d
leaq 0x1b9c6(%rip), %rsi     # 0x23f91
callq 0x7186
leaq 0x19344(%rip), %rdi     # 0x2191b
pushq $0x2
popq %rdx
movq %rdi, %rsi
callq 0xd99b
callq 0x74cb
movq 0x2e49a(%rip), %rdi     # 0x36a88
leaq 0x1b99c(%rip), %rsi     # 0x23f91
callq 0x7186
movl 0x2bc18(%rip), %edi     # 0x34218
leaq 0x2e709(%rip), %rsi     # 0x36d10
callq 0x610a
callq 0x72dc
testl %eax, %eax
je 0x864e
leaq 0x19581(%rip), %rsi     # 0x21b9d
pushq $0x78
popq %rdi
pushq $0xa
popq %rdx
callq 0x5fb8
leaq 0x192ed(%rip), %rdi     # 0x2191b
pushq $0x2
popq %rdx
movq %rdi, %rsi
callq 0xd99b
cmpl $0x0, 0x2e3dc(%rip)     # 0x36a1c
je 0x864e
leaq 0x1951d(%rip), %rdi     # 0x21b66
callq 0x40d0
movq 0x2e67b(%rip), %rdx     # 0x36cd0
testq %rdx, %rdx
je 0x867c
cmpq 0x2e687(%rip), %rdx     # 0x36ce8
je 0x867c
cmpl $0x0, 0x2e3ae(%rip)     # 0x36a18
jne 0x86d5
movq %rdx, %rdi
callq 0x59e0
andq $0x0, 0x2e654(%rip)     # 0x36cd0
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b963(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x18c4a(%rip), %rsi     # 0x212e9
leaq 0x19242(%rip), %rdx     # 0x218e8
movq %rbx, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0x816f
movq 0x2b93c(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x192bd(%rip), %rsi     # 0x21983
movq %rbx, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0x8598
movq 0x2b91c(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x192a9(%rip), %rsi     # 0x2198f
xorl %eax, %eax
callq 0x41c0
movq 0x2e5dc(%rip), %rdx     # 0x36cd0
jmp 0x866c
movq 0x2b8f8(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x191e3(%rip), %rsi     # 0x218ed
movq %rsp, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0x85b4