// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x2f563
movl $0x0, -0x4(%rbp)
jmp 0x2f9b7
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x2d, 0x1c(%rax)
je 0x2f625
jmp 0x2f577
movl 0x67663(%rip), %eax     # 0x96be0
addl $0x1, %eax
movl %eax, 0x6765a(%rip)     # 0x96be0
movq 0x1ea6b(%rip), %rax     # 0x4dff8
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x2f5a9
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x2f5b6
leaq 0x5c5b(%rip), %rax      # 0x3520b
movq %rax, -0x40(%rbp)
jmp 0x2f5b6
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x2f5d1
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x4c(%rbp)
jmp 0x2f5d8
xorl %eax, %eax
movl %eax, -0x4c(%rbp)
jmp 0x2f5d8
movl -0x4c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl 0x1c(%rax), %edi
callq 0x8270
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4ec0
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rdx
movl -0x5c(%rbp), %ecx
movq -0x58(%rbp), %r8
movq %rax, %r9
leaq 0x17868(%rip), %rsi     # 0x46e7c
movb $0x0, %al
callq 0x3170
movl $0x1, %edi
callq 0x3230
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x1ec6c(%rip), %rsi     # 0x4e2b0
callq 0x3160
cmpl $0x0, %eax
jne 0x2f65c
movl 0x67590(%rip), %eax     # 0x96be4
movl %eax, -0x4(%rbp)
jmp 0x2f9b7
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x1ec49(%rip), %rsi     # 0x4e2b8
callq 0x3160
cmpl $0x0, %eax
jne 0x2f6e2
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x2f6dd
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x2f, 0x1c(%rax)
jne 0x2f6dd
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, 0x67543(%rip)     # 0x96be8
je 0x2f6c4
movq 0x1ec0a(%rip), %rsi     # 0x4e2b8
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdx
leaq 0x18134(%rip), %rdi     # 0x477f1
movb $0x0, %al
callq 0x30f0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x2f9c0
movl %eax, -0x4(%rbp)
jmp 0x2f9b7
jmp 0x2f577
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x1ebcb(%rip), %rsi     # 0x4e2c0
callq 0x3160
cmpl $0x0, %eax
jne 0x2f719
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x2faa0
movl %eax, -0x4(%rbp)
jmp 0x2f9b7
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x1eb9c(%rip), %rsi     # 0x4e2c8
callq 0x3160
cmpl $0x0, %eax
jne 0x2f74b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2fcb0
movl %eax, -0x4(%rbp)
jmp 0x2f9b7
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x1eb72(%rip), %rsi     # 0x4e2d0
callq 0x3160
cmpl $0x0, %eax
jne 0x2f782
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x2, %edx
callq 0x2faa0
movl %eax, -0x4(%rbp)
jmp 0x2f9b7
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x1eb43(%rip), %rsi     # 0x4e2d8
callq 0x3160
cmpl $0x0, %eax
jne 0x2f7b9
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x2fe30
movl %eax, -0x4(%rbp)
jmp 0x2f9b7
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x1eb14(%rip), %rsi     # 0x4e2e0
callq 0x3160
cmpl $0x0, %eax
jne 0x2f7f0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x2, %edx
callq 0x2fe30
movl %eax, -0x4(%rbp)
jmp 0x2f9b7
movl $0x0, -0x24(%rbp)
cmpl $0x5, -0x24(%rbp)
jge 0x2f9b2
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rdi
movslq -0x24(%rbp), %rcx
leaq 0x1ea48(%rip), %rax     # 0x4e260
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x3160
cmpl $0x0, %eax
jne 0x2f9a2
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x28(%rbp)
leaq 0x672b3(%rip), %rax     # 0x96af8
movl $0x0, (%rax)
movslq -0x24(%rbp), %rcx
leaq 0x1ea0a(%rip), %rax     # 0x4e260
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x1764f(%rip), %rsi     # 0x46eb6
movl $0x6, %edx
callq 0x3070
cmpl $0x0, %eax
jne 0x2f87b
jmp 0x2f91d
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x2f894
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0xa, 0x1c(%rax)
je 0x2f8ed
jmp 0x2f896
movq 0x1e75b(%rip), %rax     # 0x4dff8
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movslq -0x24(%rbp), %rcx
leaq 0x1e9b1(%rip), %rax     # 0x4e260
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x4ec0
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rdx
movq %rax, %rcx
leaq 0x175e1(%rip), %rsi     # 0x46ebd
movb $0x0, %al
callq 0x3170
movl $0x1, %edi
callq 0x3230
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x40(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x2b4f0
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x48(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x2b4f0
movl %eax, -0x2c(%rbp)
leaq 0x671d4(%rip), %rax     # 0x96af8
cmpl $0x0, (%rax)
je 0x2f92e
jmp 0x2f896
movslq -0x24(%rbp), %rcx
leaq 0x67277(%rip), %rax     # 0x96bb0
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
leaq 0x6726a(%rip), %rax     # 0x96bb0
movl %edx, (%rax,%rcx,4)
cmpl $0x0, 0x67298(%rip)     # 0x96be8
je 0x2f97b
movslq -0x24(%rbp), %rcx
leaq 0x1e903(%rip), %rax     # 0x4e260
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl -0x28(%rbp), %edx
movl -0x2c(%rbp), %ecx
leaq 0x17563(%rip), %rdi     # 0x46ed7
movb $0x0, %al
callq 0x30f0
movslq -0x24(%rbp), %rcx
leaq 0x1e8da(%rip), %rax     # 0x4e260
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rdi
movl -0x28(%rbp), %esi
movl -0x2c(%rbp), %edx
callq *%rax
movl %eax, -0x4(%rbp)
jmp 0x2f9b7
jmp 0x2f9a4
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2f7f7
jmp 0x2f577
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq