// File: /workspace/github_c_makefile_star2_O0/nimble-code[P]Modex/Src/xtract.c
// Function: add_global
void
add_global(char *s, char *t, int d, int ln)	/* s=type, t=varname, d=derived */
{	Fcts *g, *h; char *z;

if (0)	printf("::%3d: addglobal <%s> <%s> %d -- %d -- line %d\n",
			ln, s, t, d, with_decorations, ln);

	if (strncmp(s, "void", strlen("void")) == 0
	&& !strchr(s, '*')
	&& !strchr(t, '*'))	/* void star */
	{	return;
	}

	if (strncmp(s, "static", strlen("static")) == 0)
	{	s += strlen("static");	/* can't have this in State */
		while (*s == ' ' || *s == '\t')
			s++;
	}
if (0) { if (strcmp(t, "uint") == 0) abort(); }
	if (strlen(s) == 0
	||  strlen(t) == 0)
	{	return;
	}

if (0)
	printf("%3d: addglobal <%s> <%s> %d -- %d -- line %d\n",
			ln, s, t, d, with_decorations, ln);

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

	if (strncmp(s, "extern", strlen("extern")) == 0
	||  strncmp(t, "=", 1) == 0
/*	||  (strncmp(t, "*", 1) == 0 && d != 0) */ )	// llist example
	{	return;
	}

	if (strstr(s, "struct")
	&&  (z = strchr(s, '{')))	/* assign z */
	{
		do	z++;
		while (isspace((int) *z));
		if (*z == '}')	/* empty struct declaration */
			return;
	}

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

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

	if (0)
		fprintf(stderr, "%3d:	 addglobal <%s> <%s> %d -- %d\n",
			ln, s, t, d, with_decorations);

	for (h = modex_globals; h; h = h->nxt)
	{	if (	/* strcmp(h->dt, s) == 0 &&	*/
		    strcmp(h->nm, t) == 0)
			return;
	}
	if (0) fprintf(stderr, "	ok\n");

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

	g->nxt = modex_globals;
	modex_globals = g;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x27ee8(%rip), %rsi     # 0x35349
movl $0x4, %edx
callq 0x4090
cmpl $0x0, %eax
jne 0xd49d
movq -0x8(%rbp), %rdi
movl $0x2a, %esi
callq 0x4110
cmpq $0x0, %rax
jne 0xd49d
movq -0x10(%rbp), %rdi
movl $0x2a, %esi
callq 0x4110
cmpq $0x0, %rax
jne 0xd49d
jmp 0xd6e5
movq -0x8(%rbp), %rdi
leaq 0x27ea6(%rip), %rsi     # 0x3534e
movl $0x6, %edx
callq 0x4090
cmpl $0x0, %eax
jne 0xd4fd
movq -0x8(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x31(%rbp)
je 0xd4e4
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0xd4ed
jmp 0xd4fb
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0xd4c3
jmp 0xd4fd
movq -0x8(%rbp), %rdi
callq 0x40f0
cmpq $0x0, %rax
je 0xd51b
movq -0x10(%rbp), %rdi
callq 0x40f0
cmpq $0x0, %rax
jne 0xd520
jmp 0xd6e5
jmp 0xd522
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x32(%rbp)
je 0xd543
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0xd54c
jmp 0xd55a
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xd522
movq -0x8(%rbp), %rdi
leaq 0x27df0(%rip), %rsi     # 0x35355
movl $0x6, %edx
callq 0x4090
cmpl $0x0, %eax
je 0xd58e
movq -0x10(%rbp), %rdi
leaq 0x30939(%rip), %rsi     # 0x3deb8
movl $0x1, %edx
callq 0x4090
cmpl $0x0, %eax
jne 0xd593
jmp 0xd6e5
movq -0x8(%rbp), %rdi
leaq 0x25b61(%rip), %rsi     # 0x330ff
callq 0x4280
cmpq $0x0, %rax
je 0xd602
movq -0x8(%rbp), %rdi
movl $0x7b, %esi
callq 0x4110
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xd602
jmp 0xd5c3
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
callq 0x4290
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0xd5c3
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7d, %eax
jne 0xd600
jmp 0xd6e5
jmp 0xd602
movq -0x8(%rbp), %rdi
callq 0xd060
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xd330
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x27d18(%rip), %rsi     # 0x3535c
callq 0x4180
cmpl $0x0, %eax
jne 0xd65a
movq -0x8(%rbp), %rax
addq $0x9, %rax
movq %rax, -0x8(%rbp)
movq 0x3cf37(%rip), %rax     # 0x4a598
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xd693
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x4180
cmpl $0x0, %eax
jne 0xd683
jmp 0xd6e5
jmp 0xd685
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0xd665
movq -0x10(%rbp), %rdi
callq 0x40f0
addq $0x1, %rax
movl %eax, %edi
callq 0x4a70
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x40a0
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x24(%rax)
movq 0x3cec6(%rip), %rcx     # 0x4a598
movq -0x20(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rax
movq %rax, 0x3ceb3(%rip)     # 0x4a598
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)