// File: /workspace/github_c_makefile_star2_O2/nimble-code[P]Modex/Src/xtract.c
// Function: look_lut
static char *
look_lut(char *R, char *T, int ihit)
{	Cache *c, *d, *lc = (Cache *) 0;
	int m; char *y, *z = NULL;
	char r[1024];
	static char t[2048];	/* can be returned */

// if (strstr(R, "printf")) printf("LOOK_LUT %s %s %d\n", R, T, ihit);

	while (R[strlen(R)-1] == ' ')
		R[strlen(R)-1] = '\0';

	if (ihit) R = rm_decor(R);

	r[0] = t[0] = '\0';
	while ((z = strchr(R, '%')) != NULL)
	{	*z = '\0';
		strcat(r, R);
		*z = '%';
		strcat(r, EnCode);
		R = z+1;
	}
	while ((z = strchr(T, '%')) != NULL)
	{	*z = '\0';
		strcat(t, T);
		*z = '%';
		strcat(t, EnCode);
		T = z+1;
	}
	strcat(r, R);
	strcat(t, T);

	for (c = cache; c; lc = c, c = c->nxt)
	{
// a regular expression match on c->s would go here
		if ((z = strstr(c->s, "...")) != NULL)
		{	*z = '\0';
		}
		if (strncmp(c->s, r, strlen(c->s)) == 0)
		{	m = 0;
			if (z)
			{	if (Verbose&2)
				printf("%s: prefix match1 %s -> %s\n",
					progname, r, c->s);
			} else if (strlen(c->s) != strlen(r))
			{	m = 1;
			}
		} else
		{	m = 1;
		}

		if (z)
		{	*z = '.';
			z = NULL;
		}

		if (m == 0)
		{	c->hit++;
			goto done;
	}	}
// if (strstr(R,"printf")) printf("--<<%p>>\n", c);
#if 1
	y = strstr(r, ": ");
	if (y && ihit)
	{	y += strlen(": ");
		for (c = cache; c; c = c->nxt)
		{
// a regular expression match on c->s would go here
			if ((z = strstr(c->s, "...")) != NULL)
			{	*z = '\0';
			}
			if (strncmp(c->s, y, strlen(c->s)) == 0)
			{	c->hit++;
				if (z)
				{	if (Verbose&2)
					printf("%s: prefix match2 %s -> %s\n",
						progname, y, c->s);
					if (z) { *z = '.'; z = NULL; }

// if (strstr(R,"printf")) printf("--oh no\n");
					goto done;
				} else if (strlen(c->s) == strlen(y))
				{
// if (strstr(R,"printf")) printf("--Bingo\n");
					goto done;
			}	}
			if (z)
			{	*z = '.';
				z = NULL;
	}	}	}
#endif
// if (strstr(R,"printf")) printf("--A\n");

	if (ihit && allprocs)	/* avoid out-of-context matches */
	{
// if (strstr(R, "printf")) printf("R1	%s\n", t);
		return t;
	}

	d = (Cache *) e_malloc(sizeof(Cache));
	d->level = Down;
	d->s = (char *) e_malloc(strlen(r)+1);
	strcpy(d->s, r);
	d->t = (char *) e_malloc(strlen(t)+1);
	strcpy(d->t, t);
	d->udef = 1-ihit;	/* this field cannot change */
	d->hit = ihit;	/* this field can change */
	d->printed = 0;

	if (!lc)
	{	d->nxt = cache;
		cache = d;
// printf("Addded to cache1 <%s> <%s>\n", r, t);
	} else
	{	d->nxt = c;
		lc->nxt = d;
// printf("Addded to cache2 <%s> <%s>\n", r, t);
	}

	if (ihit && omissions)
	{	printf("Omission: ");
		handle_special(stdout, r, "\t");
		handle_special(stdout, t, "\n");
	}
	c = d;
done:
// if (strstr(R, "printf")) printf("R2	%s\n", c->t);
	return c->t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movq %r15, %rdi
callq 0x4110
cmpb $0x20, -0x1(%r15,%rax)
jne 0xee31
movb $0x0, -0x1(%r15,%rax)
jmp 0xee19
testl %ebx, %ebx
movl %ebx, 0xc(%rsp)
je 0xee44
movq %r15, %rdi
callq 0xa50a
movq %rax, %r15
xorl %eax, %eax
movb %al, 0x357a4(%rip)      # 0x445f0
leaq 0x10(%rsp), %rbx
movb %al, (%rbx)
pushq $0x25
popq %rbp
movq %r15, %rdi
movl %ebp, %esi
callq 0x4130
testq %rax, %rax
je 0xee97
movq %rax, %r12
movb $0x0, (%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4290
movb $0x25, (%r12)
movq %rbx, %rdi
callq 0x4110
movups 0x1308f(%rip), %xmm0    # 0x21f19
movups %xmm0, 0x10(%rsp,%rax)
incq %r12
movq %r12, %r15
jmp 0xee56
pushq $0x25
popq %rbx
leaq 0x3574f(%rip), %r12     # 0x445f0
movq %r14, %rdi
movl %ebx, %esi
callq 0x4130
testq %rax, %rax
je 0xeee2
movq %rax, %r13
movb $0x0, (%rax)
movq %r12, %rdi
movq %r14, %rsi
callq 0x4290
movb $0x25, (%r13)
movq %r12, %rdi
callq 0x4110
movups 0x13044(%rip), %xmm0    # 0x21f19
movups %xmm0, (%rax,%r12)
incq %r13
movq %r13, %r14
jmp 0xeea1
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x4290
leaq 0x356f7(%rip), %rdi     # 0x445f0
movq %r14, %rsi
callq 0x4290
leaq 0x2dbb0(%rip), %rax     # 0x3cab8
xorl %r15d, %r15d
leaq 0x14540(%rip), %r13     # 0x23452
movq (%rax), %r14
testq %r14, %r14
je 0xef82
movq (%r14), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x42d0
movq %rax, %rbp
testq %rax, %rax
je 0xef37
movb $0x0, (%rbp)
movq (%r14), %rbx
movq %rbx, %rdi
callq 0x4110
movq %rax, %r15
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x40a0
testl %eax, %eax
je 0xef5f
testq %rbp, %rbp
je 0xef79
movb $0x2e, (%rbp)
jmp 0xef79
testq %rbp, %rbp
jne 0xf0d6
movq %r12, %rdi
callq 0x4110
cmpq %rax, %r15
je 0xf106
leaq 0x20(%r14), %rax
movq %r14, %r15
jmp 0xef12
cmpl $0x0, 0xc(%rsp)
sete %bl
leaq 0x14f78(%rip), %rsi     # 0x23f09
leaq 0x10(%rsp), %rdi
callq 0x42d0
movq %rax, %r12
testq %rax, %rax
sete %al
orb %bl, %al
jne 0xf037
addq $0x2, %r12
leaq 0x2db01(%rip), %r14     # 0x3cab8
leaq 0x14494(%rip), %r13     # 0x23452
movq (%r14), %r14
testq %r14, %r14
je 0xf037
movq (%r14), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x42d0
movq %rax, %rbp
testq %rax, %rax
je 0xefe3
movb $0x0, (%rbp)
movq (%r14), %rbx
movq %rbx, %rdi
callq 0x4110
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x40a0
testl %eax, %eax
je 0xf008
testq %rbp, %rbp
je 0xf031
movb $0x2e, (%rbp)
jmp 0xf031
incl 0x14(%r14)
testq %rbp, %rbp
jne 0xf175
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq %r12, %rdi
callq 0x4110
cmpq %rax, %rbx
je 0xf1a3
addq $0x20, %r14
jmp 0xefbe
movl 0xc(%rsp), %ebp
testl %ebp, %ebp
leaq 0x355ac(%rip), %rax     # 0x445f0
je 0xf056
leaq 0x27a1b(%rip), %rcx     # 0x36a68
cmpl $0x0, (%rcx)
jne 0xf1a7
pushq $0x28
popq %rdi
callq 0x4739
movq %rax, %r14
movl 0x2a329(%rip), %eax     # 0x39390
movl %eax, 0x1c(%r14)
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x4739
movq %rax, (%r14)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
leaq 0x3555b(%rip), %rbx     # 0x445f0
movq %rbx, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x4739
movq %rax, 0x8(%r14)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
pushq $0x1
popq %rax
subl %ebp, %eax
movl %eax, 0x10(%r14)
movl %ebp, 0x14(%r14)
andl $0x0, 0x18(%r14)
testq %r15, %r15
je 0xf10f
andq $0x0, 0x20(%r14)
addq $0x20, %r15
jmp 0xf121
leaq 0x2799f(%rip), %rax     # 0x36a7c
testb $0x2, (%rax)
je 0xf102
leaq 0x250b7(%rip), %rax     # 0x341a0
movq (%rax), %rsi
leaq 0x14363(%rip), %rdi     # 0x23456
leaq 0x10(%rsp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4140
movb $0x2e, (%rbp)
incl 0x14(%r14)
jmp 0xf1a3
leaq 0x2d9a2(%rip), %r15     # 0x3cab8
movq 0x2d99b(%rip), %rax     # 0x3cab8
movq %rax, 0x20(%r14)
movq %r14, (%r15)
testl %ebp, %ebp
je 0xf1a3
leaq 0x27b89(%rip), %rax     # 0x36cb8
cmpl $0x0, (%rax)
je 0xf1a3
leaq 0x14353(%rip), %rdi     # 0x2348e
xorl %eax, %eax
callq 0x4140
movq 0x24e87(%rip), %rbx     # 0x33fd0
movq (%rbx), %rdi
leaq 0x14e3d(%rip), %rdx     # 0x23f90
leaq 0x10(%rsp), %rsi
callq 0xa695
movq (%rbx), %rdi
leaq 0x35489(%rip), %rsi     # 0x445f0
leaq 0x134fc(%rip), %rdx     # 0x2266a
callq 0xa695
jmp 0xf1a3
leaq 0x27900(%rip), %rax     # 0x36a7c
testb $0x2, (%rax)
je 0xf19f
leaq 0x25018(%rip), %rax     # 0x341a0
movq (%rax), %rsi
leaq 0x142e0(%rip), %rdi     # 0x23472
movq %r12, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4140
movb $0x2e, (%rbp)
movq 0x8(%r14), %rax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq