// File: /workspace/github_c_makefile_star2_O0/nimble-code[P]Uno/Src/uno_lts.c
// Function: lts_node
static State *
lts_node(State *n, treenode *root)
{	Graphs *g;
	State *now = n;

	if (!root) return n;

	switch (root->hdr.type) {
	case TN_FUNC_DECL:
		if (not_a_prototype)
		{	g = new_graph(root, nmestr(((leafnode *)(root->lnode))->data.sval));
			now = g->cfg;
		}	/* parentheses were missing, bug found by uno 10/7/01 */
		break;

	case TN_DECL:
		if (curgraph == glob_decls)
			add_seq(curgraph->all, root);
		else
			now = add_seq(now, root);
		break;

	case TN_LABEL:
		if (root->lnode->hdr.tok == CASE
		||  root->lnode->hdr.tok == DEFLT)	/* case label */
		{	State *t, *stc;
			Trans *tr;
			leafnode *si;
			treenode *sl, *sn;

			t = lts_top_switch(root);	/* innermost switch stmnt */
			si = mk_ident();	/* start of this case */
			sl = mk_label_node(si, root, "case");
			sn = mk_goto_node(si);

			/* make new label; insert here
			 * add goto to this label into t->succ
			 */
			now = add_seq(now, sl);
			record_label(sl->lnode, now);

			stc = create_state(curgraph);
			stc->n = sn;		/* jump to this case */

			tr = get_trans();
			tr->branch = stc;
			tr->cond = root->lnode;	/* the expr to be matched */
			tr->nxt = t->succ;
			t->succ = tr;
			now = add_seq(now, root);

			if (root->lnode->hdr.tok == DEFLT)
				sawdefault = 1;

			if (!root->rnode
			||  !root->rnode->rnode
			||  root->rnode->rnode->hdr.type != TN_LABEL)
				want_break(root);
		} else
		{	now = add_seq(now, root);
			record_label(root->lnode, now);
		}
		now = lts_tree(now, root->rnode);	/* stmnt labeled */
		break;

	case TN_JUMP:
		switch (root->hdr.tok) {
		case CONT:
			root = lts_top_start();
			saw_break();
			break;
		case BREAK:
			root = lts_top_end();
			saw_break();
			break;
		case GOTO:
			saw_break();
			break;
		case RETURN:
			/* lnode has a return expr, if any */
			fct_retval(root);
			saw_break();
			break;
		}
		now = add_seq(now, root);
		break;


	case TN_SWITCH:
		now = lts_switch(now, root);
		break;
	case TN_WHILE:
		now = lts_while(now, root);
		break;
	case TN_DOWHILE:
		now = lts_dowhile(now, root);
		break;

	case TN_TYPE_NME:
	case TN_NAME_LIST:
	case TN_FIELD_LIST:
	case TN_IDENT_LIST:
	case TN_TYPE_LIST:
	case TN_TRANS_LIST:
	case TN_INIT_LIST:
	case TN_PARAM_LIST:
	case TN_ENUM_LIST:
	case TN_EXPR_LIST:
	case TN_BLOCK:
	case TN_STEMNT_LIST:
	case TN_DECL_LIST:
	case TN_DECLS:
		now = lts_tree(now, root->lnode);
		now = lts_tree(now, root->rnode);
		break;

	case TN_EXPR:
	case TN_SELECT:
	case TN_DEREF:
	case TN_ARRAY_DECL:
	case TN_COMP_DECL:
	case TN_BIT_FIELD:
	case TN_PNTR:
	case TN_OBJ_DEF:
	case TN_OBJ_REF:
	case TN_INIT_BLK:
	case TN_ASSIGN:
	case TN_FUNC_CALL:
	case TN_INDEX:
	case TN_EMPTY:
		break;

	case TN_STEMNT:
		if (root->rnode
		&&  root->rnode->hdr.type != TN_LABEL
		&&  (root->rnode->hdr.type != TN_JUMP
		||   root->rnode->hdr.tok == RETURN))
			now = add_seq(now, root->rnode);

		/* could be a piece of code in the sequel
		   that is reachable only via a goto
		 */
		now = lts_tree(now, root->rnode);
		break;

	case TN_CAST:
		now = lts_tree(now, root->rnode);	/* operand */
		break;

	default:
		fprintf(stderr, "uno: line %3d unexpected node %s\n",
			root->hdr.line, name_of_node(root->hdr.type));
		break;
	}

	return now;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x22c3f
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2300f
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
movq %rax, -0x60(%rbp)
subq $0x28, %rax
ja 0x22fcb
movq -0x60(%rbp), %rax
leaq 0x221f1(%rip), %rcx     # 0x44e50
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x633f1(%rip)     # 0x86060
je 0x22ca6
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x40(%rax), %rdi
callq 0x52c0
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0x20d40
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x23007
movq 0x632f6(%rip), %rax     # 0x85fa8
cmpq 0x63327(%rip), %rax     # 0x85fe0
jne 0x22cd1
movq 0x632e6(%rip), %rax     # 0x85fa8
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x232a0
jmp 0x22ce2
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x232a0
movq %rax, -0x28(%rbp)
jmp 0x23007
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x10f, 0x18(%rax)      # imm = 0x10F
je 0x22d0d
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x113, 0x18(%rax)      # imm = 0x113
jne 0x22e28
movq -0x18(%rbp), %rdi
callq 0x23460
movq %rax, -0x30(%rbp)
callq 0x19dd0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x12357(%rip), %rdx     # 0x35089
callq 0x230e0
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x23080
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x232a0
movq %rax, -0x28(%rbp)
movq -0x50(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x234d0
movq 0x63237(%rip), %rdi     # 0x85fa8
callq 0x22500
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
callq 0x23020
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x232a0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x113, 0x18(%rax)      # imm = 0x113
jne 0x22df1
movl $0x1, 0x63287(%rip)     # 0x86078
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x22e1d
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, 0x48(%rax)
je 0x22e1d
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x48(%rax), %rax
cmpl $0x22, 0x1c(%rax)
je 0x22e26
movq -0x18(%rbp), %rdi
callq 0x235d0
jmp 0x22e4a
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x232a0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x234d0
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x21040
movq %rax, -0x28(%rbp)
jmp 0x23007
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
addl $0xfffffef2, %eax       # imm = 0xFFFFFEF2
movl %eax, %ecx
movq %rcx, -0x70(%rbp)
subl $0x12, %eax
ja 0x22ec4
movq -0x70(%rbp), %rax
leaq 0x2206e(%rip), %rcx     # 0x44ef4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x236a0
movq %rax, -0x18(%rbp)
callq 0x236d0
jmp 0x22ec4
callq 0x236f0
movq %rax, -0x18(%rbp)
callq 0x236d0
jmp 0x22ec4
callq 0x236d0
jmp 0x22ec4
movq -0x18(%rbp), %rdi
callq 0x23730
callq 0x236d0
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x232a0
movq %rax, -0x28(%rbp)
jmp 0x23007
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x237a0
movq %rax, -0x28(%rbp)
jmp 0x23007
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x23910
movq %rax, -0x28(%rbp)
jmp 0x23007
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x23b70
movq %rax, -0x28(%rbp)
jmp 0x23007
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x21040
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x21040
movq %rax, -0x28(%rbp)
jmp 0x23007
jmp 0x23007
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x22f9d
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x22, 0x1c(%rax)
je 0x22f9d
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x1d, 0x1c(%rax)
jne 0x22f88
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0x120, 0x18(%rax)      # imm = 0x120
jne 0x22f9d
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x232a0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x21040
movq %rax, -0x28(%rbp)
jmp 0x23007
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rsi
callq 0x21040
movq %rax, -0x28(%rbp)
jmp 0x23007
movq 0x2b026(%rip), %rax     # 0x4dff8
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x74(%rbp)
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %edi
callq 0x8270
movq -0x80(%rbp), %rdi
movl -0x74(%rbp), %edx
movq %rax, %rcx
leaq 0x22227(%rip), %rsi     # 0x45227
movb $0x0, %al
callq 0x3170
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)