// File: /workspace/github_c_makefile_star2_O0/nimble-code[P]Uno/Src/uno_lts.c
// Function: lts_for
static State *
lts_for(State *n, for_node *forn)
{	State *now = n;
	leafnode *l;

	if (!forn) return now;

	if (forn->hdr.type == TN_FUNC_DEF)
	{
		if (!forn->stemnt)	/* no body */
			return now;	/* result of parse error */

		l = leftmost(forn->init);
		is_static_fct = (l && l->hdr.tok == STATIC);

		lts_tree(NS, forn->init);	/* type returned by fct */
		not_a_prototype++;
		now = lts_tree(NS, find_func_decl(forn->test));	/* fct name and param decls */
		not_a_prototype--;

		if (now) lts_tree(now, forn->stemnt);	/* fct body */

		curgraph = glob_decls;		/* back to global scope */
		now = curgraph->all;		/* last state from this scope */

	} else	/* for(init;test;incr) { stemnt; } */
	{
		State *ts, *es;
		Trans *tr;
		leafnode *si, *ci, *ei;
		treenode *el, *en, *sl, *cl, *sn, *cn;
		if_node *t;

		if (!forn->init)
			forn->init = mk_int(1);
		if (!forn->test)
			forn->test = mk_int(1);
		if (!forn->incr)
			forn->incr = mk_int(1);

		si = mk_ident();	/* start of loop */
		sl = mk_label_node(si, (treenode *) forn, "for");
		sn = mk_goto_node(si);

		ci = mk_ident();	/* continuation of loop */
		cl = mk_label_node(ci, (treenode *) forn, "for");
		cn = mk_goto_node(ci);

		ei = mk_ident();	/*   end of loop */
		el = mk_label_node(ei, (treenode *) forn, "for");
		en = mk_goto_node(ei);

		lts_push_start(cn);	/* set continuation point */
		lts_push_end(en);

		ts = create_state(curgraph);	/* then branch */
		ts->n = forn->stemnt;
		es = create_state(curgraph);	/* else branch */
		es->n = en;

		tr = get_trans();
		tr->cond = mk_bool("_true_");
		tr->branch = ts;
		tr->nxt = get_trans();
		tr->nxt->cond = mk_bool("_false_");
		tr->nxt->branch = es;

		if (now->n->hdr.which != FOR_T)
		{	fprintf(stderr, "\nuno: expected for (got %s)\n",
				name_of_nodetype(now->n->hdr.which));
		}

		now->n = forn->init;		/* replace for-node */
		now = lts_tree(now, sl);	/* add start label */

		t = (if_node *) emalloc(sizeof(if_node));
		t->hdr.which = IF_T;
		t->hdr.type = TN_IF;
		t->hdr.fnm = forn->hdr.fnm;
		t->hdr.line = forn->hdr.line;
		if (forn->test)
		{	t->hdr.defuse = forn->test->hdr.defuse;
#ifdef DEFTYP
			t->hdr.deftyp = forn->test->hdr.deftyp;
#endif
		}
		t->cond = forn->test;	
		t->then_n = ts->n;		/* just for form, */
		t->else_n = es->n;		/* the real info is in tr */

		now = add_seq(now, (treenode *) t); /* add loop test */
		now->succ = tr;			/* with its two branches */

		ts = lts_tree(ts, ts->n);	/* find end of loop body */

		ts = lts_tree(ts, cl);		/* add continuation label */

		ts = add_seq(ts, forn->incr);	/* add loop increment */
		ts = lts_tree(ts, sn);		/* add jump back to start */
		now = lts_tree(ts, el);		/* place the end label after that */

		lts_pop_start();
		lts_pop_end();
	}
	return now;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x227bf
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x22bff
movq -0x18(%rbp), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x228c4
movq -0x18(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x227e5
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x22bff
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x7d60
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x91(%rbp)
je 0x22819
movq -0x28(%rbp), %rax
cmpl $0x123, 0x18(%rax)      # imm = 0x123
sete %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x63826(%rip)     # 0x86050
movq 0x63827(%rip), %rdi     # 0x86058
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x21040
movl 0x6381c(%rip), %eax     # 0x86060
addl $0x1, %eax
movl %eax, 0x63813(%rip)     # 0x86060
movq 0x63804(%rip), %rax     # 0x86058
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x231b0
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x21040
movq %rax, -0x20(%rbp)
movl 0x637df(%rip), %eax     # 0x86060
addl $-0x1, %eax
movl %eax, 0x637d6(%rip)     # 0x86060
cmpq $0x0, -0x20(%rbp)
je 0x228a2
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rsi
callq 0x21040
movq 0x63737(%rip), %rax     # 0x85fe0
movq %rax, 0x636f8(%rip)     # 0x85fa8
movq 0x636f1(%rip), %rax     # 0x85fa8
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x22bf7
movq -0x18(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x228e4
movl $0x1, %edi
callq 0x19f10
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x22904
movl $0x1, %edi
callq 0x19f10
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x50(%rax)
jne 0x22924
movl $0x1, %edi
callq 0x19f10
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x50(%rax)
callq 0x19dd0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x127b6(%rip), %rdx     # 0x350f2
callq 0x230e0
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rdi
callq 0x23080
movq %rax, -0x80(%rbp)
callq 0x19dd0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x12788(%rip), %rdx     # 0x350f2
callq 0x230e0
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rdi
callq 0x23080
movq %rax, -0x88(%rbp)
callq 0x19dd0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x12757(%rip), %rdx     # 0x350f2
callq 0x230e0
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
callq 0x23080
movq %rax, -0x68(%rbp)
movq -0x88(%rbp), %rdi
callq 0x23210
movq -0x68(%rbp), %rdi
callq 0x23250
movq 0x635db(%rip), %rdi     # 0x85fa8
callq 0x22500
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq 0x635bc(%rip), %rdi     # 0x85fa8
callq 0x22500
movq %rax, -0x38(%rbp)
movq -0x68(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
callq 0x23020
movq %rax, -0x40(%rbp)
leaq 0x22696(%rip), %rdi     # 0x450a6
callq 0x19e80
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
callq 0x23020
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
leaq 0x2265c(%rip), %rdi     # 0x4509e
callq 0x19e80
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpl $0x3, (%rax)
je 0x22aa8
movq 0x2b580(%rip), %rax     # 0x4dff8
movq (%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl (%rax), %edi
callq 0x7ff0
movq -0xa8(%rbp), %rdi
movq %rax, %rdx
leaq 0x22720(%rip), %rsi     # 0x451c1
movb $0x0, %al
callq 0x3170
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x21040
movq %rax, -0x20(%rbp)
movl $0x58, %edi
callq 0x54c0
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movl $0x2, (%rax)
movq -0x90(%rbp), %rax
movl $0x1b, 0x1c(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x90(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x22b3a
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x28(%rax), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x20(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x232a0
movq %rax, -0x20(%rbp)
movq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x30(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
callq 0x21040
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x21040
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rsi
callq 0x232a0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x21040
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x21040
movq %rax, -0x20(%rbp)
callq 0x23320
callq 0x23390
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)