// File: /workspace/github_c_makefile_star2_O1/nimble-code[P]Uno/Src/uno_fcts.c
// Function: handle_fct
void
handle_fct(char *p_in)
{	static BFct *f;
	static Arc *a;
	int id;
	char *t;
	char p[512];

	if (strlen(p_in) >= 512)
	{	fprintf(stderr, "uno:global: very long fct name <%s>\n", p_in);
		exit(1);
	}
	strcpy(p, p_in);	/* p_in could be a constant string */

	t = strchr(p, '\r');
	if (t) *t = '\0';
	t = strchr(p, '\n');
	if (t) *t = '\0';

	if (0) { printf("'%s' (%d)\n", p, (int) strlen(p)); fflush(stdout); }

	switch (*p) {
	case ':':	/* reminder of fct name - already created */
		t = strchr(p+2, '\t');
		if (!t) goto bad1;
		*t = '\0';
		f = find_function(p+2);
		if (!f)
		{
bad1:			fprintf(stderr, "uno:global: fct reminder invalid '%s'\n", p);
			exit(1);
		}
		*t = '\t';
		oid = 0;
		break;

	case '{':
		if (sscanf(p, "{%d}", &id) != 1)
bad:			fprintf(stderr, "uno:global: bad fct delimiter: '%s'\n", p);
		else
			a = add_arc(f, oid, id);	/* uno can't tell that f was initialized */
		break;

	case '<':
		if (sscanf(p, "<%d>", &id) != 1)
			goto bad;
		else
			oid = id;
		break;

	case '>':
		if (sscanf(p, ">%d>", &id) != 1)
			goto bad;
		else
		{	a = add_arc(f, oid, id);
			oid = id;
		}
		break;

	case '[':
		t = strrchr(p, ']');
		if (!t) goto bad;
		*t = '\0';
		if (t > p+1)
		{	if (!a)
			{	fprintf(stderr, "uno:global: zero arc error\n");
				exit(1);
			}
			add_label(f, a, p+1);
		}
		*t = ']';
		break;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdi, %rbx
callq 0x1080
cmpq $0x200, %rax            # imm = 0x200
jae 0x3177
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1050
movq %r14, %rdi
movl $0xd, %esi
callq 0x1090
testq %rax, %rax
je 0x2ede
movb $0x0, (%rax)
leaq 0x10(%rsp), %rdi
movl $0xa, %esi
callq 0x1090
testq %rax, %rax
je 0x2ef5
movb $0x0, (%rax)
movzbl 0x10(%rsp), %eax
cmpl $0x3d, %eax
jle 0x2f5d
cmpl $0x3e, %eax
je 0x2f91
cmpl $0x5b, %eax
je 0x2fde
cmpl $0x7b, %eax
jne 0x3149
leaq 0x2880(%rip), %rsi      # 0x57a1
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x1120
cmpl $0x1, %eax
jne 0x3119
movq 0x536e(%rip), %rdi      # 0x82b0
movl 0x5378(%rip), %esi      # 0x82c0
movl 0xc(%rsp), %edx
callq 0x318e
movq %rax, 0x5360(%rip)      # 0x82b8
jmp 0x3149
cmpl $0x3a, %eax
je 0x3038
cmpl $0x3c, %eax
jne 0x3149
leaq 0x2855(%rip), %rsi      # 0x57cb
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x1120
cmpl $0x1, %eax
je 0x2fcf
jmp 0x3119
leaq 0x23a2(%rip), %rsi      # 0x533a
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x1120
cmpl $0x1, %eax
jne 0x3119
movq 0x52f7(%rip), %rdi      # 0x82b0
movl 0x5301(%rip), %esi      # 0x82c0
movl 0xc(%rsp), %edx
callq 0x318e
movq %rax, 0x52e9(%rip)      # 0x82b8
movl 0xc(%rsp), %eax
movl %eax, 0x52e7(%rip)      # 0x82c0
jmp 0x3149
leaq 0x10(%rsp), %rdi
movl $0x5d, %esi
callq 0x10b0
testq %rax, %rax
je 0x3119
movq %rax, %rbx
movb $0x0, (%rax)
leaq 0x11(%rsp), %r14
cmpq %r14, %rax
jbe 0x3146
movq 0x52a7(%rip), %r12      # 0x82b8
testq %r12, %r12
je 0x3189
movq 0x528f(%rip), %r13      # 0x82b0
movq %r14, %rdi
movl $0x9, %esi
callq 0x1090
testq %rax, %rax
je 0x3083
movb $0x20, (%rax)
jmp 0x3021
leaq 0x12(%rsp), %r14
movq %r14, %rdi
movl $0x9, %esi
callq 0x1090
testq %rax, %rax
je 0x317f
movq %rax, %rbx
movb $0x0, (%rax)
movq %r14, %rdi
callq 0x2a92
movq %rax, 0x5248(%rip)      # 0x82b0
testq %rax, %rax
je 0x317f
movb $0x9, (%rbx)
movl $0x0, 0x5242(%rip)      # 0x82c0
jmp 0x3149
movl $0x10, %edi
callq 0x151c
movq %rax, %r15
movq %r14, %rdi
callq 0x29ce
movq %rax, (%r15)
movq (%r13), %rdi
leaq 0x277a(%rip), %rsi      # 0x5820
callq 0x10e0
testl %eax, %eax
je 0x3138
movq (%r12), %rax
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%r15)
movq %r15, 0x8(%rax)
movq %r14, %rdi
callq 0x1080
cmpq $0x3, %rax
jb 0x3146
movzbl 0x12(%rsp), %esi
cmpl $0x20, %esi
je 0x30e5
cmpl $0x9, %esi
jne 0x315a
movl $0x9, %esi
leaq 0x13(%rsp), %rdi
callq 0x1090
testq %rax, %rax
je 0x315a
movb $0x0, (%rax)
movzbl 0x11(%rsp), %ecx
addl $-0x43, %ecx
cmpl $0x27, %ecx
ja 0x315a
movabsq $0xe180048813, %rdx     # imm = 0xE180048813
btq %rcx, %rdx
jae 0x315a
movb $0x20, (%rax)
jmp 0x3146
movq 0x4ed0(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x267c(%rip), %rsi      # 0x57a6
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x10f0
jmp 0x3149
movq 0x8(%r12), %rax
movq %rax, 0x8(%r15)
movq %r15, 0x8(%r12)
movb $0x5d, (%rbx)
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x4e8f(%rip), %rax      # 0x7ff0
movq (%rax), %rdi
leaq 0x2b33(%rip), %rsi      # 0x5c9e
movq %r14, %rdx
xorl %eax, %eax
callq 0x10f0
jmp 0x3146
movq %rbx, %rdi
callq 0x13c7
leaq 0x10(%rsp), %rdi
callq 0x13a3
callq 0x137e