// File: /workspace/github_c_makefile_star2_O2/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, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
leaq 0x160fa(%rip), %rsi     # 0x21f8d
pushq $0x6
popq %rdx
callq 0x40a0
testl %eax, %eax
je 0xbfd2
movl %ebp, 0x14(%rsp)
cmpb $0x0, (%r12)
je 0xc00a
movb (%r14), %bpl
testb %bpl, %bpl
je 0xc00a
cmpb $0x2d, (%rbx)
jne 0xbed5
cmpb $0x0, 0x1(%rbx)
jne 0xbed5
jmp 0xc00a
movb 0x1(%r14), %bpl
incq %r14
cmpb $0x20, %bpl
je 0xbece
movzbl %bpl, %r13d
cmpl $0x9, %r13d
je 0xbece
leaq 0x160a8(%rip), %rsi     # 0x21f94
pushq $0x6
popq %rdx
movq %r12, %rdi
callq 0x40a0
testl %eax, %eax
je 0xc00a
cmpb $0x2a, %bpl
je 0xc00a
cmpl $0x3d, %r13d
je 0xc00a
leaq 0x16081(%rip), %rsi     # 0x21f9b
movq %r12, %rdi
callq 0x41b0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leaq (%rcx,%rcx,8), %r13
addq %r12, %r13
leaq 0x2d499(%rip), %rbp     # 0x393d0
movq (%rbp), %rbp
testq %rbp, %rbp
je 0xc019
movq 0x10(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x41b0
testl %eax, %eax
jne 0xbfc9
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq %r13, %rdi
callq 0x4110
cmpq %rax, %r12
jne 0xbfc9
movq (%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x41b0
testl %eax, %eax
jne 0xbfc9
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq %r14, %rdi
callq 0x4110
cmpq %rax, %r12
jne 0xbfc9
movq 0x8(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x41b0
testl %eax, %eax
jne 0xbfc9
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq %rbx, %rdi
callq 0x4110
cmpq %rax, %r12
je 0xc0d3
addq $0x38, %rbp
jmp 0xbf37
addq $0x6, %r12
movzbl (%r12), %eax
cmpl $0x20, %eax
je 0xbfe5
cmpl $0x9, %eax
jne 0xbfea
incq %r12
jmp 0xbfd6
movq %r12, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xac17
leaq 0x2aa7f(%rip), %rax     # 0x36a80
cmpl $0x0, (%rax)
jne 0xc09f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rdi
callq 0xa9ba
movq %rax, %r12
movq (%rax), %rax
movq %rax, 0x10(%r12)
movl %r15d, 0x34(%r12)
movq %r14, %rdi
movq %r12, %rsi
callq 0xab68
movq %rax, %r14
movq %rax, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x4739
movq %rax, (%r12)
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
movq %rbx, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x4739
movq %rax, 0x8(%r12)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
movl 0x14(%rsp), %eax
movl %eax, 0x24(%r12)
movq 0x2d342(%rip), %rax     # 0x393d0
movq %rax, 0x38(%r12)
movq %r12, 0x2d336(%rip)     # 0x393d0
jmp 0xc00a
movq 0x27f52(%rip), %rax     # 0x33ff8
movq (%rax), %rdi
leaq 0x280f0(%rip), %rax     # 0x341a0
movq (%rax), %rdx
movq %rbx, (%rsp)
leaq 0x15f80(%rip), %rsi     # 0x2203e
movl %r15d, %ecx
movq %r12, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x41c0
jmp 0xc00a
leaq 0x2a98e(%rip), %rax     # 0x36a68
cmpl $0x0, (%rax)
je 0xc0eb
movl $0x1, 0x28(%rbp)
jmp 0xc00a
leaq 0x280b6(%rip), %rax     # 0x341a8
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x41b0
testl %eax, %eax
jne 0xc00a
jmp 0xc0df