// File: /workspace/github_c_makefile_star2_O0/nimble-code[P]Uno/Src/uno_fcts.c
// Function: act_select
static int
act_select(Label *n, Label *m, int t)
{	unsigned char *p;
	int ret = 0;
	int x, y, xx;
	int truth = t;

	/*
	 *  n = sys  -- e.g. "C nm file line -- R x file line"
	 *  m = prop -- e.g. "ftc_call('nm') -- select('x', DEREF, NONE)"
	 */

	if (strncmp((char *) m->label, "!fct_call(", strlen("!fct_call(")) == 0)
	{	truth = (truth == 1) ? -1 : 1;
		goto n_fct;
	}
	if (strncmp((char *) m->label, "!select(", strlen("!select(")) == 0)
	{	truth = (truth == 1) ? -1 : 1;
		xx = x = strlen("select('',");
		goto n_sel;
	}
	if (strncmp((char *) m->label, "!(uno_state", strlen("!(uno_state")) == 0)
	{	truth = (truth == 1) ? -1 : 1;
		p = &(m->label[strlen("!(uno_state")]);
		goto n_uno;
	}

	if (strncmp((char *) m->label, "fct_call(", strlen("fct_call(")) == 0)
	{
n_fct:		if (has_fct_match(n, m))
		{	if (debug)
			printf("\tfct match '%s' <-> '%s' (want %d)\n",
				n->label, m->label, truth);

			if (truth ==  1) return 1;
			if (truth == -1) return 0;
			return 1;	/* fct_call as stmnt, matching */
		} else
		{	if (truth ==  1) return 0;
			if (truth == -1) return 1;
			return 0;	/* fct_call as stmnt, not matching */
	}	}

	if (strncmp((char *) m->label, "select(", strlen("select(")) == 0)
	{
		/* 4 args:  name, domatch, nomatch, mark */
		/* name must be "" or '' for now */
		xx = strlen("select('',");
n_sel:
		if ((!strstr((char *) m->label, "(\"\",")
		  && !strstr((char *) m->label, "('',"))
		||  !isdigit(m->label[xx]))
		{
 if (0)
 { fprintf(stderr, "<%s> %d '%s' %p,%d\n", &(m->label[xx]),
	xx, m->label,
	strstr((char *) m->label, "('',"),
	isdigit(m->label[xx]));
 }
			notyet(m, "args to select1");
		}
		if (sscanf((char *) &(m->label[xx]), "%d,%d", &x, &y) != 2)
		{	notyet(m, "args to select2");
		}

		if ((x|y) & ~(DEF|USE|DEREF|PARAM))	/* only D, U, or R marks matter */
		{
 if (0)
 { fprintf(stderr, "x=%d, y=%d\n", x, y);
 }
			notyet(m, "2nd or 3rd arg to select");
		}

		ret = has_sel_match(n, x, y);
		if (truth == -1) ret = 1 - ret;

		if (debug) printf("lm: %s <-> %s -- returns %d\n", n->label, m->label, ret);
		return ret;
	}

	if (strncmp((char *) m->label, "(uno_state", strlen("(uno_state")) == 0)
	{	p = &(m->label[strlen("(uno_state")]);
n_uno:		switch (*p) {
		case '!':
			if (*(p+1) != '=' || !isdigit(*(p+2))) notyet(m, "operator");
			ret = (stack->uno_state != atoi((char *) p+2));
			break;
		case '=':
			if (*(p+1) != '=' || !isdigit(*(p+2))) notyet(m, "operator");
			ret = (stack->uno_state == atoi((char *) p+2));
			break;
		case '>':
			if (*(p+1) == '=')
			{	if (!isdigit(*(p+2))) notyet(m, "operator");
				ret = (stack->uno_state >= atoi((char *) p+2));
			} else
			{	if (!isdigit(*(p+1))) notyet(m, "operator");
				ret = (stack->uno_state > atoi((char *) p+1));
			}
			break;
		case '<':
			if (*(p+1) == '=')
			{	if (!isdigit(*(p+2))) notyet(m, "operator");
				ret = (stack->uno_state <= atoi((char *) p+2));
			} else
			{	if (!isdigit(*(p+1))) notyet(m, "operator");
				ret = (stack->uno_state < atoi((char *) p+1));
			}
			break;
		default:
			notyet(m, "operator");
		}
		if (truth == -1) ret = 1 - ret;

		if (debug)
		printf("\tcmd '%s' == %d\n", m->label, ret);
		return ret;
	}
	if (debug)
	{	notyet(m, "unrecognized command");
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0x2157(%rip), %rsi      # 0x8055
movl $0xa, %edx
callq 0x1030
cmpl $0x0, %eax
jne 0x5f28
movl -0x3c(%rbp), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5fd8
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0x212a(%rip), %rsi      # 0x8060
movl $0x8, %edx
callq 0x1030
cmpl $0x0, %eax
jne 0x5f6e
movl -0x3c(%rbp), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x3c(%rbp)
movl $0xa, -0x30(%rbp)
movl $0xa, -0x38(%rbp)
jmp 0x609a
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0x20ed(%rip), %rsi      # 0x8069
movl $0xb, %edx
callq 0x1030
cmpl $0x0, %eax
jne 0x5fb5
movl -0x3c(%rbp), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
addq $0xb, %rax
movq %rax, -0x28(%rbp)
jmp 0x61e3
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0x2093(%rip), %rsi      # 0x8056
movl $0x9, %edx
callq 0x1030
cmpl $0x0, %eax
jne 0x6072
jmp 0x5fd8
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x6b60
cmpl $0x0, %eax
je 0x6042
cmpl $0x0, 0x53cf(%rip)      # 0xb3c0
je 0x6012
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movl -0x3c(%rbp), %ecx
leaq 0x206a(%rip), %rdi      # 0x8075
movb $0x0, %al
callq 0x1080
cmpl $0x1, -0x3c(%rbp)
jne 0x6024
movl $0x1, -0x4(%rbp)
jmp 0x64f6
cmpl $-0x1, -0x3c(%rbp)
jne 0x6036
movl $0x0, -0x4(%rbp)
jmp 0x64f6
movl $0x1, -0x4(%rbp)
jmp 0x64f6
cmpl $0x1, -0x3c(%rbp)
jne 0x6054
movl $0x0, -0x4(%rbp)
jmp 0x64f6
cmpl $-0x1, -0x3c(%rbp)
jne 0x6066
movl $0x1, -0x4(%rbp)
jmp 0x64f6
movl $0x0, -0x4(%rbp)
jmp 0x64f6
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0x1fe1(%rip), %rsi      # 0x8061
movl $0x7, %edx
callq 0x1030
cmpl $0x0, %eax
jne 0x61b3
movl $0xa, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0x1ff1(%rip), %rsi      # 0x8099
callq 0x1150
cmpq $0x0, %rax
jne 0x60cc
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0x1fdd(%rip), %rsi      # 0x809e
callq 0x1150
cmpq $0x0, %rax
je 0x60f4
callq 0x1160
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x38(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x6104
movq -0x18(%rbp), %rdi
leaq 0x1fa4(%rip), %rsi      # 0x80a3
callq 0x55f0
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movslq -0x38(%rbp), %rax
addq %rax, %rdi
leaq 0x1e5a(%rip), %rsi      # 0x7f73
leaq -0x30(%rbp), %rdx
leaq -0x34(%rbp), %rcx
movb $0x0, %al
callq 0x1100
cmpl $0x2, %eax
je 0x613d
movq -0x18(%rbp), %rdi
leaq 0x1f7b(%rip), %rsi      # 0x80b3
callq 0x55f0
movl -0x30(%rbp), %eax
orl -0x34(%rbp), %eax
andl $0xffffbfba, %eax       # imm = 0xFFFFBFBA
cmpl $0x0, %eax
je 0x615d
movq -0x18(%rbp), %rdi
leaq 0x1f6b(%rip), %rsi      # 0x80c3
callq 0x55f0
movq -0x10(%rbp), %rdi
movl -0x30(%rbp), %esi
movl -0x34(%rbp), %edx
callq 0x6d40
movl %eax, -0x2c(%rbp)
cmpl $-0x1, -0x3c(%rbp)
jne 0x6180
movl $0x1, %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, 0x5239(%rip)      # 0xb3c0
je 0x61a8
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movl -0x2c(%rbp), %ecx
leaq 0x1f3b(%rip), %rdi      # 0x80dc
movb $0x0, %al
callq 0x1080
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x64f6
movq -0x18(%rbp), %rax
movq (%rax), %rdi
leaq 0x1ea9(%rip), %rsi      # 0x806a
movl $0xa, %edx
callq 0x1030
cmpl $0x0, %eax
jne 0x64d7
movq -0x18(%rbp), %rax
movq (%rax), %rax
addq $0xa, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
addl $-0x21, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x1d, %eax
ja 0x648d
movq -0x48(%rbp), %rax
leaq 0x153d(%rip), %rcx      # 0x7744
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x28(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x623e
callq 0x1160
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x624e
movq -0x18(%rbp), %rdi
leaq 0x1eb0(%rip), %rsi      # 0x80f9
callq 0x55f0
movq 0x5163(%rip), %rax      # 0xb3b8
movswl 0x8(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x28(%rbp), %rdi
addq $0x2, %rdi
callq 0x1120
movl %eax, %ecx
movl -0x4c(%rbp), %eax
cmpl %ecx, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
jmp 0x649d
movq -0x28(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x62ae
callq 0x1160
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x62be
movq -0x18(%rbp), %rdi
leaq 0x1e40(%rip), %rsi      # 0x80f9
callq 0x55f0
movq 0x50f3(%rip), %rax      # 0xb3b8
movswl 0x8(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
addq $0x2, %rdi
callq 0x1120
movl %eax, %ecx
movl -0x50(%rbp), %eax
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
jmp 0x649d
movq -0x28(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x635d
callq 0x1160
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x632e
movq -0x18(%rbp), %rdi
leaq 0x1dd0(%rip), %rsi      # 0x80f9
callq 0x55f0
movq 0x5083(%rip), %rax      # 0xb3b8
movswl 0x8(%rax), %eax
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rdi
addq $0x2, %rdi
callq 0x1120
movl %eax, %ecx
movl -0x54(%rbp), %eax
cmpl %ecx, %eax
setge %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
jmp 0x63bb
callq 0x1160
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x638e
movq -0x18(%rbp), %rdi
leaq 0x1d70(%rip), %rsi      # 0x80f9
callq 0x55f0
movq 0x5023(%rip), %rax      # 0xb3b8
movswl 0x8(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
callq 0x1120
movl %eax, %ecx
movl -0x58(%rbp), %eax
cmpl %ecx, %eax
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
jmp 0x649d
movq -0x28(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x642d
callq 0x1160
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x63fe
movq -0x18(%rbp), %rdi
leaq 0x1d00(%rip), %rsi      # 0x80f9
callq 0x55f0
movq 0x4fb3(%rip), %rax      # 0xb3b8
movswl 0x8(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x28(%rbp), %rdi
addq $0x2, %rdi
callq 0x1120
movl %eax, %ecx
movl -0x5c(%rbp), %eax
cmpl %ecx, %eax
setle %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
jmp 0x648b
callq 0x1160
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x645e
movq -0x18(%rbp), %rdi
leaq 0x1ca0(%rip), %rsi      # 0x80f9
callq 0x55f0
movq 0x4f53(%rip), %rax      # 0xb3b8
movswl 0x8(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
callq 0x1120
movl %eax, %ecx
movl -0x60(%rbp), %eax
cmpl %ecx, %eax
setl %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
jmp 0x649d
movq -0x18(%rbp), %rdi
leaq 0x1c61(%rip), %rsi      # 0x80f9
callq 0x55f0
cmpl $-0x1, -0x3c(%rbp)
jne 0x64ae
movl $0x1, %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, 0x4f0b(%rip)      # 0xb3c0
je 0x64cf
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movl -0x2c(%rbp), %edx
leaq 0x1c3a(%rip), %rdi      # 0x8102
movb $0x0, %al
callq 0x1080
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x64f6
cmpl $0x0, 0x4ee2(%rip)      # 0xb3c0
je 0x64f0
movq -0x18(%rbp), %rdi
leaq 0x1c28(%rip), %rsi      # 0x8113
callq 0x55f0
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop