// File: /workspace/github_c_makefile_star2_O1/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, %r13
movq %rsi, %r14
movq %rdi, %r12
leaq 0x175d1(%rip), %rsi     # 0x2508d
movl $0x6, %edx
callq 0x40a0
testl %eax, %eax
je 0xdafd
cmpb $0x0, (%r12)
je 0xdb35
cmpb $0x0, (%r14)
je 0xdb35
leaq 0x16fbd(%rip), %rsi     # 0x24a9b
movq %r13, %rdi
callq 0x41b0
testl %eax, %eax
je 0xdb35
movzbl (%r14), %ebx
cmpl $0x20, %ebx
je 0xdaf8
cmpl $0x9, %ebx
jne 0xdb44
incq %r14
jmp 0xdaea
addq $0x6, %r12
movzbl (%r12), %eax
cmpl $0x20, %eax
je 0xdb10
cmpl $0x9, %eax
jne 0xdb15
incq %r12
jmp 0xdb01
movq %r12, %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %r15d, %ecx
callq 0xca19
leaq 0x2bf44(%rip), %rax     # 0x39a70
cmpl $0x0, (%rax)
jne 0xdcb0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17549(%rip), %rsi     # 0x25094
movl $0x6, %edx
movq %r12, %rdi
callq 0x40a0
testl %eax, %eax
je 0xdb35
cmpl $0x2a, %ebx
je 0xdb35
cmpl $0x3d, %ebx
je 0xdb35
movq %r13, 0x10(%rsp)
leaq 0x17529(%rip), %rsi     # 0x2509b
movq %r12, %rdi
callq 0x41b0
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
leaq (%rcx,%rcx,8), %r13
addq %r12, %r13
movq 0x2e831(%rip), %rbx     # 0x3c3c0
testq %rbx, %rbx
je 0xdc29
movq 0x10(%rbx), %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x41b0
testl %eax, %eax
jne 0xdc20
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq %r13, %rdi
callq 0x4110
cmpq %rax, %r12
jne 0xdc20
movq (%rbx), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x41b0
testl %eax, %eax
jne 0xdc20
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq %r14, %rdi
callq 0x4110
cmpq %rax, %r12
jne 0xdc20
movq 0x8(%rbx), %r12
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x41b0
testl %eax, %eax
jne 0xdc20
movq %r12, %rdi
callq 0x4110
movq %rax, %r12
movq 0x10(%rsp), %rdi
callq 0x4110
cmpq %rax, %r12
je 0xdce4
movq 0x38(%rbx), %rbx
jmp 0xdb8f
movq %r13, %rdi
callq 0xc799
movq %rax, %r12
movq (%rax), %rax
movq %rax, 0x10(%r12)
movl %r15d, 0x34(%r12)
movq %r14, %rdi
movq %r12, %rsi
callq 0xc949
movq %rax, %r14
movq %rax, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6469
movq %rax, (%r12)
movq %rax, %rdi
movq %r14, %rsi
callq 0x40b0
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x4110
leal 0x1(%rax), %edi
callq 0x6469
movq %rax, 0x8(%r12)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x40b0
movl %ebp, 0x24(%r12)
movq 0x2e721(%rip), %rax     # 0x3c3c0
movq %rax, 0x38(%r12)
movq %r12, 0x2e715(%rip)     # 0x3c3c0
jmp 0xdb35
movq 0x29341(%rip), %rax     # 0x36ff8
movq (%rax), %rdi
leaq 0x294cf(%rip), %rax     # 0x37190
movq (%rax), %rdx
movq %r13, (%rsp)
leaq 0x1746f(%rip), %rsi     # 0x2513e
movl %r15d, %ecx
movq %r12, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x41c0
jmp 0xdb35
leaq 0x2bd6d(%rip), %rax     # 0x39a58
cmpl $0x0, (%rax)
movq 0x10(%rsp), %rdi
je 0xdd01
movl $0x1, 0x28(%rbx)
jmp 0xdb35
leaq 0x29490(%rip), %rax     # 0x37198
movq (%rax), %rsi
callq 0x41b0
testl %eax, %eax
jne 0xdb35
jmp 0xdcf5