// File: /workspace/github_c_makefile_star2_O3/nimble-code[P]Uno/Src/uno_generic.c
// Function: eval_fct
int
eval_fct(treenode *e, treenode *n)
{	leafnode *leaf;
	int i, val1, val2;

	if (!e) return 0;

	if (e->lnode->hdr.type != TN_IDENT)
	{
bad1:		err_path++;
		fprintf(stderr, "eval_fct:\n\t%s:%d: expect ident for fctname, got %s in %s\n",
			n?n->hdr.fnm:"--",
			n?n->hdr.line:0,
			name_of_node(e->lnode->hdr.type), x_stmnt(e));
		exit(1);
	}

	leaf = (leafnode *) e->lnode;
	if (strcmp(leaf->data.sval->str, endname) == 0)
		return path_ends;

	if (strcmp(leaf->data.sval->str, callname) == 0)
	{	if (e->rnode
		&&  e->rnode->hdr.type == TN_STRING)
		{	leaf = (leafnode *) e->rnode;

			if (debug) printf("saw %s(%s)\n", callname, leaf->data.str);

			return has_ident(n, leaf->data.str);
		}
		goto bad1;
	}

	if (strcmp(leaf->data.sval->str, selname) == 0)
		return sel_args(e, n, 1);

	if (strcmp(leaf->data.sval->str, refname) == 0)
		return ref_args(e, n);

	if (strcmp(leaf->data.sval->str, excname) == 0)
		return sel_args(e, n, 2);

	if (strcmp(leaf->data.sval->str, matchname) == 0)
		return match_args(e, n, 1);

	if (strcmp(leaf->data.sval->str, markedname) == 0)
		return match_args(e, n, 2);

	for (i = 0; i < (int) (sizeof(evals)/sizeof(struct Cmd)); i++)
		if (strcmp(leaf->data.sval->str, evals[i].cmd) == 0)
		{
			val1 = val2 = 0;	/* set defaults */
			nogood = 0;

			if (strncmp(evals[i].cmd, "known_", strlen("known_")) == 0)
				goto doit;	/* no args */

			/* everything else has two args */

			if (!e->rnode
			||   e->rnode->hdr.type != TN_EXPR_LIST)
			{
bad2:				fprintf(stderr, "uno: bad fct args %s(%s)\n",
					evals[i].cmd, x_stmnt(e->rnode));
				exit(1);
			}

			val1 = eval_const_expr(e->rnode->lnode, n);
			val2 = eval_const_expr(e->rnode->rnode, n);
doit:			if (nogood) goto bad2;

			hit_fcts[i]++;
			if (debug) printf("saw %s(%d,%d)\n", evals[i].cmd, val1, val2);
			return evals[i].fn(n, val1, val2);
		}
	goto bad1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %ebp, %ebp
testq %rdi, %rdi
je 0x1c551
movq %rsi, %rbx
movq %rdi, %r14
movq 0x40(%rdi), %rax
movl 0x1c(%rax), %r15d
cmpl $0x2d, %r15d
jne 0x1c53d
movq 0x40(%rax), %rax
movq 0x8(%rax), %r12
leaq 0x14c42(%rip), %rsi     # 0x310b5
movq %r12, %rdi
callq 0x3190
testl %eax, %eax
je 0x1c54b
leaq 0x14c35(%rip), %rsi     # 0x310bf
movq %r12, %rdi
callq 0x3190
testl %eax, %eax
je 0x1c562
leaq 0x12e13(%rip), %rsi     # 0x2f2b4
movq %r12, %rdi
callq 0x3190
testl %eax, %eax
je 0x1c58b
leaq 0x14c41(%rip), %rsi     # 0x310f9
movq %r12, %rdi
callq 0x3190
testl %eax, %eax
je 0x1c59b
leaq 0x14c51(%rip), %rsi     # 0x31120
movq %r12, %rdi
callq 0x3190
testl %eax, %eax
je 0x1c666
leaq 0x14c43(%rip), %rsi     # 0x31129
movq %r12, %rdi
callq 0x3190
testl %eax, %eax
je 0x1c6ec
leaq 0x14c55(%rip), %rsi     # 0x31152
movq %r12, %rdi
callq 0x3190
testl %eax, %eax
je 0x1c6f9
xorl %eax, %eax
leaq 0x1b87a(%rip), %rcx     # 0x37d90
movq (%rcx,%rax,4), %r13
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rbp
callq 0x3190
testl %eax, %eax
je 0x1c684
addq $0x4, %rbp
cmpq $0x14, %rbp
movq %rbp, %rax
jne 0x1c50f
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x4228
movl 0x64523(%rip), %ebp     # 0x80a74
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%r14), %rax
testq %rax, %rax
je 0x1c53d
cmpl $0x2f, 0x1c(%rax)
jne 0x1c53d
movq 0x40(%rax), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1c762
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
jmp 0x1c671
movq 0x48(%r14), %r12
testq %r12, %r12
je 0x1c747
cmpl $0xa, 0x1c(%r12)
jne 0x1c747
movq 0x40(%r12), %rdi
testq %rdi, %rdi
je 0x1c747
cmpq $0x0, 0x48(%r12)
je 0x1c747
leaq 0x643c3(%rip), %r13     # 0x80998
movl $0x0, (%r13)
movq %rbx, %rsi
callq 0x1a750
movl %eax, %r15d
movq 0x48(%r12), %rdi
movq %rbx, %rsi
callq 0x1a750
cmpl $0x0, (%r13)
jne 0x1c747
testq %rbx, %rbx
je 0x1c551
cmpl $0x1b, 0x1c(%rbx)
jne 0x1c61c
movq 0x40(%rbx), %rbx
testq %rbx, %rbx
je 0x1c551
movq 0x28(%rbx), %rcx
testq %rcx, %rcx
je 0x1c551
movq 0x18(%rcx), %rcx
testq %rcx, %rcx
je 0x1c551
xorl %edx, %edx
cmpl $0x0, (%rcx)
je 0x1c654
movl 0x4(%rcx), %esi
testl %r15d, %esi
je 0x1c64e
movl $0x1, %ebp
andl %eax, %esi
je 0x1c656
movl $0x0, (%rcx)
movl %edx, %ebp
movq 0x10(%rcx), %rcx
movl %ebp, %edx
testq %rcx, %rcx
jne 0x1c638
jmp 0x1c551
movq %r14, %rdi
movq %rbx, %rsi
movl $0x2, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1c7d5
movq %rbp, %r12
leaq 0x6430a(%rip), %r15     # 0x80998
movl $0x0, (%r15)
leaq 0x14902(%rip), %rsi     # 0x30f9e
movl $0x6, %edx
movq %r13, %rdi
callq 0x3080
testl %eax, %eax
je 0x1c717
movq 0x48(%r14), %rdi
testq %rdi, %rdi
je 0x1c752
cmpl $0xa, 0x1c(%rdi)
jne 0x1c75a
movq 0x40(%rdi), %rdi
movq %rbx, %rsi
callq 0x1a750
movl %eax, %ebp
movq 0x48(%r14), %rax
movq 0x48(%rax), %rdi
movq %rbx, %rsi
callq 0x1a750
cmpl $0x0, (%r15)
jne 0x1c756
movl %eax, %edx
jmp 0x1c71b
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %edx
jmp 0x1c704
movq %r14, %rdi
movq %rbx, %rsi
movl $0x2, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1c996
xorl %edx, %edx
xorl %ebp, %ebp
leaq 0x6431e(%rip), %rax     # 0x80a40
movq %r12, %rcx
incl (%r12,%rax)
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x1b65b(%rip), %rax     # 0x37d90
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *0x8(%rax,%rcx,4)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41d4
xorl %edi, %edi
jmp 0x1c75a
movq 0x48(%r14), %rdi
movq %r13, %rsi
callq 0x419f