// File: /workspace/github_c_makefile_star2_O3/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, %ebp
movq %rsi, %r15
movq %rdi, %r14
callq 0x4110
cmpb $0x20, -0x1(%r14,%rax)
jne 0x10cde
leaq -0x1(%r14), %rbx
leaq (%r14,%rax), %rcx
decq %rcx
movb $0x0, (%rcx)
movq %r14, %rdi
callq 0x4110
leaq (%rbx,%rax), %rcx
cmpb $0x20, -0x1(%r14,%rax)
je 0x10cc7
testl %ebp, %ebp
je 0x10ced
movq %r14, %rdi
callq 0xc117
movq %rax, %r14
xorl %eax, %eax
movb %al, 0x358fb(%rip)      # 0x465f0
movb %al, 0x10(%rsp)
movq %r14, %rdi
movl $0x25, %esi
callq 0x4130
testq %rax, %rax
je 0x10d57
movq %rax, %r13
leaq 0x10(%rsp), %r12
movb $0x0, (%r13)
movq %r12, %rdi
movq %r14, %rsi
callq 0x4290
movb $0x25, (%r13)
movq %r12, %rdi
callq 0x4110
movups 0x132e2(%rip), %xmm0    # 0x24019
movups %xmm0, 0x10(%rsp,%rax)
movq %r13, %r14
incq %r14
movq %r14, %rdi
movl $0x25, %esi
callq 0x4130
movq %rax, %r13
testq %rax, %rax
jne 0x10d13
movq %r15, %rdi
movl $0x25, %esi
callq 0x4130
testq %rax, %rax
je 0x10db7
movq %rax, %r13
leaq 0x3587d(%rip), %r12     # 0x465f0
movb $0x0, (%r13)
movq %r12, %rdi
movq %r15, %rsi
callq 0x4290
movb $0x25, (%r13)
movq %r12, %rdi
callq 0x4110
movups 0x13282(%rip), %xmm0    # 0x24019
movups %xmm0, (%rax,%r12)
movq %r13, %r15
incq %r15
movq %r15, %rdi
movl $0x25, %esi
callq 0x4130
movq %rax, %r13
testq %rax, %rax
jne 0x10d73
movl %ebp, 0xc(%rsp)
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x4290
leaq 0x35821(%rip), %rdi     # 0x465f0
movq %r15, %rsi
callq 0x4290
movq 0x2dcda(%rip), %rax     # 0x3eab8
testq %rax, %rax
je 0x10e5e
leaq 0x14768(%rip), %r14     # 0x25552
leaq 0x10(%rsp), %r12
movq %rax, %r15
movq (%rax), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x42d0
movq %rax, %r13
testq %rax, %rax
je 0x10e10
movb $0x0, (%r13)
movq (%r15), %rbp
movq %rbp, %rdi
callq 0x4110
movq %rax, %rbx
movq %rbp, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x40a0
testl %eax, %eax
je 0x10e39
testq %r13, %r13
je 0x10e53
movb $0x2e, (%r13)
jmp 0x10e53
testq %r13, %r13
jne 0x10fcb
movq %r12, %rdi
callq 0x4110
cmpq %rax, %rbx
je 0x10ffc
movq 0x20(%r15), %rax
testq %rax, %rax
jne 0x10def
jmp 0x10e61
xorl %r15d, %r15d
cmpl $0x0, 0xc(%rsp)
sete %bl
leaq 0x15199(%rip), %rsi     # 0x26009
leaq 0x10(%rsp), %rdi
callq 0x42d0
movq %rax, %r12
testq %rax, %rax
sete %al
orb %bl, %al
jne 0x10f22
movq 0x2dc26(%rip), %r14     # 0x3eab8
testq %r14, %r14
je 0x10f22
addq $0x2, %r12
leaq 0x146ac(%rip), %rbx     # 0x25552
movq (%r14), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x42d0
movq %rax, %r13
testq %rax, %rax
je 0x10ec4
movb $0x0, (%r13)
movq (%r14), %rbp
movq %rbp, %rdi
callq 0x4110
movq %rbp, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x40a0
testl %eax, %eax
je 0x10eea
testq %r13, %r13
je 0x10f19
movb $0x2e, (%r13)
jmp 0x10f19
incl 0x14(%r14)
testq %r13, %r13
jne 0x1106b
movq %rbp, %rdi
callq 0x4110
movq %rbx, %r13
movq %rax, %rbx
movq %r12, %rdi
callq 0x4110
cmpq %rax, %rbx
movq %r13, %rbx
je 0x1109a
movq 0x20(%r14), %r14
testq %r14, %r14
jne 0x10ea6
movl 0xc(%rsp), %ebp
testl %ebp, %ebp
leaq 0x356c1(%rip), %rax     # 0x465f0
je 0x10f41
leaq 0x27b30(%rip), %rcx     # 0x38a68
cmpl $0x0, (%rcx)
jne 0x110a1
movl $0x28, %edi
callq 0x6321
movq %rax, %r14
movl 0x2a43c(%rip), %eax     # 0x3b390
movl %eax, 0x1c(%r14)
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6321
movq %rax, (%r14)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
leaq 0x3566e(%rip), %rbx     # 0x465f0
movq %rbx, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6321
movq %rax, 0x8(%r14)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
movl $0x1, %eax
subl %ebp, %eax
movl %eax, 0x10(%r14)
movl %ebp, 0x14(%r14)
movl $0x0, 0x18(%r14)
testq %r15, %r15
je 0x11005
movq $0x0, 0x20(%r14)
addq $0x20, %r15
jmp 0x11017
leaq 0x27aaa(%rip), %rax     # 0x38a7c
testb $0x2, (%rax)
je 0x10ff7
leaq 0x251c2(%rip), %rax     # 0x361a0
movq (%rax), %rsi
leaq 0x1456e(%rip), %rdi     # 0x25556
leaq 0x10(%rsp), %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x4140
movb $0x2e, (%r13)
incl 0x14(%r15)
jmp 0x1109d
leaq 0x2daac(%rip), %r15     # 0x3eab8
movq 0x2daa5(%rip), %rax     # 0x3eab8
movq %rax, 0x20(%r14)
movq %r14, (%r15)
testl %ebp, %ebp
je 0x1109a
leaq 0x27c93(%rip), %rax     # 0x38cb8
cmpl $0x0, (%rax)
je 0x1109a
leaq 0x1455d(%rip), %rdi     # 0x2558e
xorl %eax, %eax
callq 0x4140
movq 0x24f91(%rip), %rbx     # 0x35fd0
movq (%rbx), %rdi
leaq 0x15047(%rip), %rdx     # 0x26090
leaq 0x10(%rsp), %rsi
callq 0xc2de
movq (%rbx), %rdi
leaq 0x35593(%rip), %rsi     # 0x465f0
leaq 0x13706(%rip), %rdx     # 0x2476a
callq 0xc2de
jmp 0x1109a
leaq 0x27a0a(%rip), %rax     # 0x38a7c
testb $0x2, (%rax)
je 0x11095
leaq 0x25122(%rip), %rax     # 0x361a0
movq (%rax), %rsi
leaq 0x144ea(%rip), %rdi     # 0x25572
movq %r12, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x4140
movb $0x2e, (%r13)
movq %r14, %r15
movq 0x8(%r15), %rax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq