// File: /workspace/github_c_makefile_star2_O2/nimble-code[P]Modex/Src/xtract.c
// Function: get_lut
void
get_lut(char *o_base, char *lut)
{	FILE *lf;
	char buf[2048], *p, *q, *r;
	char nbuf[2048];
	int cntr=0;

// printf("GET LUT '%s'\n", lut?lut:"");

	if (!lut)
	{	lut = (char *) e_malloc(strlen(o_base)+strlen(".lut")+1);
		strcpy(lut, o_base);
		strcat(lut, ".lut");
	} else
	{	if (!strstr(lut, ".lut"))
			strcat(lut, ".lut");
	}

	if (Verbose)
		printf("get lut %s\n", lut);

	add_hidden(NONPRINT, "__iob", 0, 0);

	if ((lf = fopen(lut, "rb")) == NULL)
	{	if (!new_lut
		&&  Warnings
		&&  strncmp(lut, "none", strlen("none")) != 0)
			fprintf(stderr, "%s: warning, no file '%s'\n", progname, lut);
		FreshLut = 1;
		goto done;
	} else if (!new_lut && Warnings)
		fprintf(stderr, "%s: using '%s'\n", progname, lut);

if (debug_io) fprintf(stderr, "open lut -> %p\n", lf);

	while (fgets(buf, sizeof(buf), lf))
	{	while ((p = strrchr(buf, '\n'))
		||     (p = strrchr(buf, '\r')))
			*p = '\0';

		while (buf[strlen(buf)-1] == '\t'
		||     buf[strlen(buf)-1] == ' ')
			buf[strlen(buf)-1] = '\0';

		if (buf[strlen(buf)-1] == '\\')
			read_more(lf, buf);

		if (buf[0] == '#' || !strchr(buf, '\t'))
		{	add_comment(cntr++, buf);
			continue;
		}

		if (strncmp(buf, "Include", strlen("Include")) == 0)
		{	p = nextarg(buf);
			(void) nextarg(p);
			add_include(p);
			Down += 2;
			get_lut("", p);	/* recursive call -- not visible */
			Down -= 2;
			continue;
		}

		if (strncmp(buf, "Suppress", strlen("Suppress")) == 0)
		{	fprintf(stderr, "Suppress command obsolete (ignored, use Import)\n");
			continue;
		}

		if (strncmp(buf, "Insert",  strlen("Insert")) == 0
		||  strncmp(buf, "Declare", strlen("Declare")) == 0)
		{	p = nextarg(buf);
			q = nextarg(p);
			r = nextarg(q);
			if (*r == '\0')
			{	fprintf(stderr, "usage:	Insert\ttype\tvname\tpname/Global\n");
				fprintf(stderr, "or:	Declare\ttype\tvname\tpname/Global\n");
				exit(1);
			}
			(void) nextarg(r);
			add_imported(q, r, 1);
			if (strcmp(r, "Global") == 0)
			{	add_full_global(p, q, 1, 0);
			} else
			{	add_full_local(p, q, r, 1, 0);
			}
			continue;
		}
		if (strncmp(buf, "Promela", strlen("Promela")) == 0)
		{	p = nextarg(buf);
			q = nextarg(p);
			if (*q == '\0')
			{	fprintf(stderr, "usage: Promela\tvname\tpname/Global\n");
				exit(1);
			}
			(void) nextarg(q);
			add_imported(p, q, 0);	/* 0 - do not generate declaration */
			continue;
		}
		if (strncmp(buf, "Import", strlen("Import")) == 0)
		{	p = nextarg(buf);
			q = nextarg(p);
			if (*q == '\0')
			{	fprintf(stderr, "usage: Import\tvname\tpname/Global\n");
				exit(1);
			}
			(void) nextarg(q);
if (0) fprintf(stderr, "A%d %s\n", saw_import, wanttype);
			add_imported(p, q, 1);
			saw_import++;
if (0) fprintf(stderr, "B%d %s\n", saw_import, wanttype);
			continue;
		}
		if (strncmp(buf, "Constant", strlen("Constant")) == 0)
		{	add_constants(nextarg(buf));
			continue;
		}
		if (strncmp(buf, "ICALL", strlen("ICALL")) == 0
		||  strncmp(buf, "Icall", strlen("Icall")) == 0)
		{	/* instrumented procedure calls */
			p = nextarg(buf);
			q = nextarg(p);
			if (*q != '\0')
			{	fprintf(stderr, "usage: Icall\tfct_name\n");
				exit(1);
			}
			add_icall(p);
			continue;
		}
		if (strncmp(buf, "Global", strlen("Global")) == 0)
		{	p = nextarg(buf);
			q = nextarg(p);
			if (*q == '\0')
			{	fprintf(stderr, "usage: Global\ttype\tvarname\n");
				exit(1);
			}
			(void) nextarg(q);
			add_global(p, q, 0, 0);
			continue;
		}
		if (strncmp(buf, "External", strlen("External")) == 0)
		{	fprintf(stderr, "External is obsolete, use Track\n");
			exit(1);
		}
		if (strncmp(buf, "Track", strlen("Track")) == 0)
		{	p = nextarg(buf);
			q = nextarg(p);
			if (*q == '\0')
			{	fprintf(stderr, "usage: Track\t&n\tsizeof(int)\n");
				exit(1);
			}
			(void) nextarg(q);
			add_external(p, q);
			continue;
		}
		if (strncmp(buf, NONSTATE, strlen(NONSTATE)) == 0)
		{	p = nextarg(buf);
			q = nextarg(p);
			if (*q == '\0')
			{	fprintf(stderr, "usage: %s\ttype\tvarname\n", NONSTATE);
				exit(1);
			}
			(void) nextarg(q);
			add_hidden(p, q, 0, 0);
			continue;
		}
		if (strncmp(buf, "Local", strlen("Local")) == 0)
		{	p = nextarg(buf);
			q = nextarg(p);
			r = nextarg(q);
			if (*r == '\0')
			{	fprintf(stderr, "usage: Local\ttype\tvarname\tprocname\n");
				exit(1);
			}
			(void) nextarg(r);
			add_local(p, q, r, 0, 0, 30);
			continue;
		}
		if (strncmp(buf, "Function", strlen("Function")) == 0)
		{	p = nextarg(buf);
			(void) nextarg(p);
			add_fct(p, p);

			sprintf(nbuf, "(%s", p);
			add_fct(nbuf, p);

			sprintf(nbuf, "(!%s", p);
			add_fct(nbuf, p);
			continue;
		}
		if (strncmp(buf, "Substitute", strlen("Substitute")) == 0)
		{	p = nextarg(buf);
			q = nextarg(p);
			(void) nextarg(q);
			add_substitute(p, q);
			continue;
		}

		p = nextarg(buf);	/* regular mapping src -> dst */
		if (*p != '\0')
		{	look_lut(buf, p, 0);	/* store it */
			cntr++;
		}
	}
if (debug_io) fprintf(stderr, "close w %p\n", lf);
	Fclose(lf);

done:
if (0) fprintf(stderr, "C%d %s\n", saw_import, wanttype);
	if (!saw_import)
	{	add_imported("_all_", "_all_", 1);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
testq %rsi, %rsi
je 0xe540
movq %rsi, %r14
leaq 0x14478(%rip), %rsi     # 0x229a9
movq %r14, %rdi
callq 0x42d0
testq %rax, %rax
jne 0xe574
jmp 0xe55e
movq %rdi, %rbx
callq 0x4110
leal 0x5(%rax), %edi
callq 0x4739
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
movq %r14, %rdi
callq 0x4110
movl $0x74756c2e, (%r14,%rax) # imm = 0x74756C2E
movb $0x0, 0x4(%r14,%rax)
leaq 0x28501(%rip), %rax     # 0x36a7c
cmpl $0x0, (%rax)
je 0xe591
leaq 0x141f9(%rip), %rdi     # 0x22780
movq %r14, %rsi
xorl %eax, %eax
callq 0x4140
leaq 0x1cea3(%rip), %rdi     # 0x2b43b
leaq 0x141ed(%rip), %rsi     # 0x2278c
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xaa70
leaq 0x141e3(%rip), %rsi     # 0x22792
movq %r14, %rdi
callq 0x4270
leaq 0x286ee(%rip), %rcx     # 0x36cac
cmpl $0x0, (%rcx)
sete %cl
leaq 0x284b5(%rip), %rdx     # 0x36a80
cmpl $0x0, (%rdx)
movq %rax, %r12
setne %al
andb %cl, %al
testq %r12, %r12
je 0xec1d
testb %al, %al
jne 0xec6f
leaq 0x2842a(%rip), %rax     # 0x36a18
cmpl $0x0, (%rax)
jne 0xec99
leaq 0x10(%rsp), %r14
pushq $0xa
popq %rbp
pushq $0xd
popq %r15
xorl %r13d, %r13d
movq %r12, 0x8(%rsp)
movl %r13d, %ebx
movq %r14, %rdi
movl $0x800, %esi            # imm = 0x800
movq %r12, %rdx
callq 0x4190
testq %rax, %rax
je 0xec03
pushq $0x1
popq %r13
movq %r14, %rdi
movl %ebp, %esi
callq 0x4150
testq %rax, %rax
jne 0xe64a
movq %r14, %rdi
movl %r15d, %esi
callq 0x4150
testq %rax, %rax
je 0xe654
movb $0x0, (%rax)
jmp 0xe62b
movb $0x0, 0xf(%rsp,%rax)
movq %r14, %rdi
callq 0x4110
movzbl -0x1(%rax,%r14), %ecx
cmpl $0x9, %ecx
je 0xe64f
cmpl $0x20, %ecx
je 0xe64f
cmpl $0x5c, %ecx
jne 0xe67c
movq %r12, %rdi
movq %r14, %rsi
callq 0xe453
cmpb $0x23, 0x10(%rsp)
je 0xe761
movq %r14, %rdi
pushq $0x9
popq %rsi
callq 0x4130
testq %rax, %rax
je 0xe761
movq %rbx, (%rsp)
movq %r14, %rdi
leaq 0x1412c(%rip), %rsi     # 0x227d5
pushq $0x7
popq %rdx
callq 0x4250
testl %eax, %eax
je 0xe7fb
movq 0x10(%rsp), %rbx
movabsq $0x7373657270707553, %rax # imm = 0x7373657270707553
cmpq %rax, %rbx
je 0xe9fd
movq %r14, %rdi
leaq 0x14133(%rip), %rsi     # 0x2280e
pushq $0x6
popq %rdx
callq 0x4250
testl %eax, %eax
je 0xe83f
movq %r14, %rdi
leaq 0x14120(%rip), %rsi     # 0x22815
pushq $0x7
popq %rdx
callq 0x4250
testl %eax, %eax
je 0xe83f
movq %r14, %rdi
leaq 0x1415a(%rip), %rsi     # 0x22869
pushq $0x7
popq %rdx
callq 0x4250
movq %r14, %rdi
testl %eax, %eax
je 0xe8b4
leaq 0x1416b(%rip), %rsi     # 0x22894
pushq $0x6
popq %rdx
callq 0x4250
testl %eax, %eax
je 0xe8e7
movabsq $0x746e6174736e6f43, %rax # imm = 0x746E6174736E6F43
movq %r14, %rdi
cmpq %rax, %rbx
jne 0xe933
callq 0xe39d
movq %rax, %rdi
callq 0xe3c8
jmp 0xe833
leal 0x1(%rbx), %r13d
movq %r14, %rdi
leaq 0x131ff(%rip), %rsi     # 0x2196e
pushq $0x14
popq %rdx
callq 0x4250
testl %eax, %eax
je 0xe60b
pushq $0x28
popq %rdi
callq 0x4739
movq %rax, %r12
movl 0x2ac00(%rip), %eax     # 0x39390
movl %eax, 0x1c(%r12)
movq %r14, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x4739
movq %rax, (%r12)
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
decl %ebx
movl %ebx, 0x14(%r12)
andl $0x0, 0x18(%r12)
andq $0x0, 0x20(%r12)
movq 0x349f2(%rip), %rax     # 0x431c0
leaq 0x20(%rax), %rcx
testq %rax, %rax
leaq 0x349e4(%rip), %rax     # 0x431c0
cmoveq %rax, %rcx
leaq 0x2e2d9(%rip), %rdx     # 0x3cac0
cmoveq %rdx, %rax
movq %r12, (%rcx)
movq %r12, (%rax)
movq 0x8(%rsp), %r12
jmp 0xe60b
movq %r14, %rdi
callq 0xe39d
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
movq %rbx, %rdi
callq 0xa850
addl $0x2, 0x2ab73(%rip)     # 0x39390
leaq 0x1576d(%rip), %rdi     # 0x23f91
movq %rbx, %rsi
callq 0xe511
addl $-0x2, 0x2ab5d(%rip)    # 0x39390
movq (%rsp), %rax
movl %eax, %r13d
jmp 0xe60b
movq %r14, %rdi
callq 0xe39d
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
movq %rax, %r13
movq %rax, %rdi
callq 0xe39d
cmpb $0x0, (%rax)
je 0xed03
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
movq %r13, %rdi
movq %rbx, %rsi
pushq $0x1
popq %rdx
callq 0xd99b
movq %rbx, %rdi
leaq 0x1182d(%rip), %rsi     # 0x200b6
callq 0x41b0
movq %r12, %rdi
movq %r13, %rsi
testl %eax, %eax
je 0xe8a8
movq %rbx, %rdx
pushq $0x1
popq %rcx
xorl %r8d, %r8d
callq 0xc107
jmp 0xe922
pushq $0x1
popq %rdx
xorl %ecx, %ecx
callq 0xadb9
jmp 0xe922
callq 0xe39d
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
cmpb $0x0, (%rax)
je 0xed37
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0xd99b
jmp 0xe922
movq %r14, %rdi
callq 0xe39d
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
cmpb $0x0, (%rax)
je 0xed4f
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
movq %rbx, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0xd99b
incl 0x2e18e(%rip)           # 0x3cab0
movq (%rsp), %rax
movl %eax, %r13d
movq 0x8(%rsp), %r12
jmp 0xe60b
leaq 0x13f83(%rip), %rsi     # 0x228bd
pushq $0x5
popq %r13
movq %r13, %rdx
callq 0x4250
testl %eax, %eax
je 0xea1e
movq %r14, %rdi
leaq 0x13f6b(%rip), %rsi     # 0x228c3
movq %r13, %rdx
callq 0x4250
testl %eax, %eax
je 0xea1e
movq %r14, %rdi
leaq 0x11744(%rip), %rsi     # 0x200b6
pushq $0x6
popq %rdx
callq 0x4250
testl %eax, %eax
je 0xea47
movabsq $0x6c616e7265747845, %rax # imm = 0x6C616E7265747845
cmpq %rax, %rbx
je 0xed7c
movq %r14, %rdi
leaq 0x13f7e(%rip), %rsi     # 0x2291d
movq %r13, %rdx
callq 0x4250
testl %eax, %eax
je 0xea82
movabsq $0x65746174536e6f4e, %rax # imm = 0x65746174536E6F4E
movq %r14, %rdi
cmpq %rax, %rbx
jne 0xeab9
callq 0xe39d
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
cmpb $0x0, (%rax)
je 0xedbb
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xaa70
jmp 0xe922
movq 0x255f4(%rip), %rax     # 0x33ff8
movq (%rax), %rcx
leaq 0x13dcf(%rip), %rdi     # 0x227dd
pushq $0x30
popq %rsi
pushq $0x1
popq %rdx
callq 0x42c0
jmp 0xe833
movq %r14, %rdi
callq 0xe39d
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
cmpb $0x0, (%rax)
jne 0xed67
movq %rbx, %rdi
callq 0x5831
jmp 0xe833
movq %r14, %rdi
callq 0xe39d
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
cmpb $0x0, (%rax)
je 0xed91
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xac17
jmp 0xe922
movq %r14, %rdi
callq 0xe39d
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
cmpb $0x0, (%rax)
je 0xeda6
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe2f8
jmp 0xe922
leaq 0x13e98(%rip), %rsi     # 0x22958
movq %r13, %rdx
callq 0x4250
testl %eax, %eax
je 0xeb48
movabsq $0x6e6f6974636e7546, %rax # imm = 0x6E6F6974636E7546
movq %r14, %rdi
cmpq %rax, %rbx
jne 0xeb92
callq 0xe39d
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
movq %r12, %rdi
movq %r12, %rsi
callq 0xa7db
leaq 0x810(%rsp), %rbx
movq %rbx, %rdi
leaq 0x13e73(%rip), %rsi     # 0x22982
movq %r12, %rdx
xorl %eax, %eax
callq 0x42a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa7db
movq %rbx, %rdi
leaq 0x13e58(%rip), %rsi     # 0x22986
movq %r12, %rdx
xorl %eax, %eax
callq 0x42a0
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa7db
jmp 0xe922
movq %r14, %rdi
callq 0xe39d
movq %rax, %rbx
movq %rax, %rdi
callq 0xe39d
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
cmpb $0x0, (%rax)
je 0xeddc
movq %rax, %r13
movq %rax, %rdi
callq 0xe39d
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0xbe70
jmp 0xe922
leaq 0x13df2(%rip), %rsi     # 0x2298b
pushq $0xa
popq %rdx
callq 0x4250
movl %eax, %r12d
movq %r14, %rdi
callq 0xe39d
testl %r12d, %r12d
je 0xebdd
cmpb $0x0, (%rax)
movq (%rsp), %rbx
movl %ebx, %r13d
movq 0x8(%rsp), %r12
je 0xe60b
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xee00
incl %ebx
movl %ebx, %r13d
jmp 0xe60b
movq %rax, %rdi
movq %rax, %rbx
callq 0xe39d
movq %rax, %r12
movq %rax, %rdi
callq 0xe39d
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa91d
jmp 0xe922
leaq 0x27e0e(%rip), %rax     # 0x36a18
cmpl $0x0, (%rax)
jne 0xecb9
movq %r12, %rdi
callq 0x59e0
jmp 0xec42
testb %al, %al
je 0xec3b
leaq 0x13b6d(%rip), %rsi     # 0x22795
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x40a0
testl %eax, %eax
jne 0xecd9
movb $0x1, 0x2de72(%rip)     # 0x3cab4
cmpl $0x0, 0x2de67(%rip)     # 0x3cab0
jne 0xec5d
leaq 0x12cc9(%rip), %rdi     # 0x2191b
pushq $0x1
popq %rdx
movq %rdi, %rsi
callq 0xd99b
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x25382(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x25520(%rip), %rax     # 0x341a0
movq (%rax), %rdx
leaq 0x13b2b(%rip), %rsi     # 0x227b5
movq %r14, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0xe5e7
movq 0x25358(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x13b1b(%rip), %rsi     # 0x227c5
movq %r12, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xe5f7
movq 0x25338(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x13ccc(%rip), %rsi     # 0x22996
movq %r12, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xec13
movq 0x25318(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x254b6(%rip), %rax     # 0x341a0
movq (%rax), %rdx
leaq 0x13aa6(%rip), %rsi     # 0x2279a
movq %r14, %rcx
xorl %eax, %eax
callq 0x41c0
jmp 0xec3b
movq 0x252ee(%rip), %r14     # 0x33ff8
movq (%r14), %rcx
leaq 0x13b09(%rip), %rdi     # 0x2281d
pushq $0x26
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x42c0
movq (%r14), %rcx
leaq 0x13b18(%rip), %rdi     # 0x22844
pushq $0x24
popq %rsi
movq %rbx, %rdx
jmp 0xedf3
movq 0x252ba(%rip), %rax     # 0x33ff8
movq (%rax), %rcx
leaq 0x13b29(%rip), %rdi     # 0x22871
pushq $0x22
jmp 0xedef
movq 0x252a2(%rip), %rax     # 0x33ff8
movq (%rax), %rcx
leaq 0x13b3b(%rip), %rdi     # 0x2289b
pushq $0x21
jmp 0xedef
movq 0x2528a(%rip), %rax     # 0x33ff8
movq (%rax), %rcx
leaq 0x13b51(%rip), %rdi     # 0x228c9
pushq $0x16
jmp 0xedef
movq 0x25275(%rip), %rax     # 0x33ff8
movq (%rax), %rcx
leaq 0x13b6f(%rip), %rdi     # 0x228fc
pushq $0x20
jmp 0xedef
movq 0x25260(%rip), %rax     # 0x33ff8
movq (%rax), %rcx
leaq 0x13b3e(%rip), %rdi     # 0x228e0
pushq $0x1b
jmp 0xedef
movq 0x2524b(%rip), %rax     # 0x33ff8
movq (%rax), %rcx
leaq 0x13b6c(%rip), %rdi     # 0x22923
pushq $0x1c
jmp 0xedef
movq 0x25236(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x13b74(%rip), %rsi     # 0x22940
leaq 0x132b7(%rip), %rdx     # 0x2208a
xorl %eax, %eax
callq 0x41c0
jmp 0xedf8
movq 0x25215(%rip), %rax     # 0x33ff8
movq (%rax), %rcx
leaq 0x13b71(%rip), %rdi     # 0x2295e
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
callq 0x42c0
pushq $0x1
popq %rdi
callq 0x42b0