// File: /workspace/github_c_makefile_star2_O3/nimble-code[P]Modex/Src/xtract.c
// Function: add_local
void
add_local(char *s, char *t, char *r, int d, int ln, int which)
{	Fcts *g;

if (0) fprintf(stderr, "Add_Local <%s> <%s> <%s> which=%d\n", s, t, r, which);

	if (strncmp(s, "static", strlen("static")) == 0)
	{	s += strlen("static");	/* can't have this in a State vector decl. */
		while (*s == ' ' || *s == '\t')
			s++;
		add_global(s, t, d, ln);	/* static local becomes global */
		if (Warnings)
		fprintf(stderr, "%s: %3d, warning, treating <%s %s> in <%s> as global\n",
			progname, ln, s, t, r);
		return;
	}

	if (strlen(s) == 0
	||  strlen(t) == 0
	||  strcmp(r, "-") == 0)
		return;

	while (*t == ' ' || *t == '\t')
		t++;

	if (strncmp(s, "extern", strlen("extern")) == 0
	||  strncmp(t, "=", 1) == 0
	||  strncmp(t, "*", 1) == 0)
		return;

	if (strcmp(s, "unsigned unsigned ") == 0)
	{	s += strlen("unsigned ");
	}

if (0)	printf("%3d: {%d} addlocal <%s> <%s> <%s> %d -- want=%s -- inargs=%d\n",
		ln, which, s, t, r, d, want, in_args);

	for (g = modex_locals; g; g = g->nxt)
	{
if (0) printf("\tcheck <%s> <%s> <%s>\n", g->dt, g->nm, g->tg);
		if (strcmp(g->dt, s) == 0 && strlen(g->dt) == strlen(s)
		&&  strcmp(g->nm, t) == 0 && strlen(g->nm) == strlen(t)
		&&  strcmp(g->tg, r) == 0 && strlen(g->tg) == strlen(r))
		{	if (allprocs
			||  strcmp(r, want) == 0)
				g->wanted = 1;
if (0)	printf("	found %s\n", t);
			return;
		}
	}

	g = modex_fct_el(s);
	g->dt = g->nm;
	g->lno = ln;

	t = sep_decor(t, g);

	g->nm = (char *) e_malloc(strlen(t)+1);
	strcpy(g->nm, t);

	g->tg = (char *) e_malloc(strlen(r)+1);
	strcpy(g->tg, r);

	g->derived = d;

if (0) printf("%3d: added dt=%s nm=%s tg=%s (s=%s t=%s r=%s d=%d)\n",
		g->lno, g->dt, g->nm, g->tg, s, t, r, d);

	g->nxt = modex_locals;
	modex_locals = g;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r15d
movl %ecx, %ebx
movq %rdx, %rbp
movq %rsi, %r14
movq %rdi, %r12
leaq 0x16710(%rip), %rsi     # 0x2408d
movl $0x6, %edx
callq 0x40a0
testl %eax, %eax
je 0xdab9
movl %ebx, 0x14(%rsp)
cmpb $0x0, (%r12)
je 0xdaf1
movb (%r14), %bl
testb %bl, %bl
je 0xdaf1
cmpb $0x2d, (%rbp)
jne 0xd9c1
cmpb $0x0, 0x1(%rbp)
jne 0xd9c1
jmp 0xdaf1
movb 0x1(%r14), %bl
incq %r14
cmpb $0x20, %bl
je 0xd9ba
movzbl %bl, %r13d
cmpl $0x9, %r13d
je 0xd9ba
leaq 0x166bd(%rip), %rsi     # 0x24094
movl $0x6, %edx
movq %r12, %rdi
callq 0x40a0
testl %eax, %eax
je 0xdaf1
cmpb $0x2a, %bl
je 0xdaf1
cmpl $0x3d, %r13d
je 0xdaf1
leaq 0x16695(%rip), %rsi     # 0x2409b
movq %r12, %rdi
callq 0x41c0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leaq (%rcx,%rcx,8), %r13
addq %r12, %r13
movq 0x2d9ad(%rip), %rbx     # 0x3b3d0
testq %rbx, %rbx
je 0xdb00
movq 0x10(%rbx), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x41c0
testl %eax, %eax
jne 0xdab0
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq %r13, %rdi
callq 0x4110
cmpq %rax, %r12
jne 0xdab0
movq (%rbx), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x41c0
testl %eax, %eax
jne 0xdab0
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq %r14, %rdi
callq 0x4110
cmpq %rax, %r12
jne 0xdab0
movq 0x8(%rbx), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x41c0
testl %eax, %eax
jne 0xdab0
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq %rbp, %rdi
callq 0x4110
cmpq %rax, %r12
je 0xdbba
movq 0x38(%rbx), %rbx
jmp 0xda23
addq $0x6, %r12
movzbl (%r12), %eax
cmpl $0x20, %eax
je 0xdacc
cmpl $0x9, %eax
jne 0xdad1
incq %r12
jmp 0xdabd
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
movl %r15d, %ecx
callq 0xc8be
leaq 0x2af98(%rip), %rax     # 0x38a80
cmpl $0x0, (%rax)
jne 0xdb86
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0xc63e
movq %rax, %r12
movq (%rax), %rax
movq %rax, 0x10(%r12)
movl %r15d, 0x34(%r12)
movq %r14, %rdi
movq %r12, %rsi
callq 0xc7ee
movq %rax, %r14
movq %rax, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6321
movq %rax, (%r12)
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
movq %rbp, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6321
movq %rax, 0x8(%r12)
movq %rax, %rdi
movq %rbp, %rsi
callq 0x40b0
movl 0x14(%rsp), %eax
movl %eax, 0x24(%r12)
movq 0x2d85b(%rip), %rax     # 0x3b3d0
movq %rax, 0x38(%r12)
movq %r12, 0x2d84f(%rip)     # 0x3b3d0
jmp 0xdaf1
movq 0x2846b(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
leaq 0x28609(%rip), %rax     # 0x361a0
movq (%rax), %rdx
movq %rbp, (%rsp)
leaq 0x16599(%rip), %rsi     # 0x2413e
movl %r15d, %ecx
movq %r12, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x41d0
jmp 0xdaf1
leaq 0x2aea7(%rip), %rax     # 0x38a68
cmpl $0x0, (%rax)
je 0xdbd2
movl $0x1, 0x28(%rbx)
jmp 0xdaf1
leaq 0x285cf(%rip), %rax     # 0x361a8
movq (%rax), %rsi
movq %rbp, %rdi
callq 0x41c0
testl %eax, %eax
jne 0xdaf1
jmp 0xdbc6