// File: /workspace/github_c_makefile_star2_O1/nimble-code[P]Uno/Src/uno_lts.c
// Function: lts_while
static State *
lts_while(State *now, treenode *node)	/* lnode - cond; rnode - body */
{	State *ts, *es;
	Trans *tr;
	leafnode *si, *ei;
	treenode *el, *en;
	treenode *sl, *sn;
	if_node *t;

	if (!node->lnode)
		node->lnode = mk_int(1);
	if (!node->rnode)
		node->rnode = mk_int(1);

	si = mk_ident();	/* start of loop */
	sl = mk_label_node(si, node, "while");
	sn = mk_goto_node(si);

	ei = mk_ident();	/*   end of loop */
	el = mk_label_node(ei, node, "while");
	en = mk_goto_node(ei);

	lts_push_start(sn);
	lts_push_end(en);

	ts = create_state(curgraph);	/* then branch */
	ts->n = node->rnode;		/* while body */
	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;

	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 = node->hdr.fnm;
	t->hdr.line = node->hdr.line;
	t->hdr.defuse = node->lnode->hdr.defuse;
#ifdef DEFTYP
	t->hdr.deftyp = node->lnode->hdr.deftyp;
#endif

	t->cond = node->lnode;		/* loop condition */
	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, 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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, 0x10(%rsp)
cmpq $0x0, 0x40(%rsi)
jne 0x16f8b
movl $0x1, %edi
callq 0x1028c
movq %rax, 0x40(%rbx)
cmpq $0x0, 0x48(%rbx)
jne 0x16fa0
movl $0x1, %edi
callq 0x1028c
movq %rax, 0x48(%rbx)
callq 0x101ad
movq %rax, %r15
leaq 0x18fbc(%rip), %r12     # 0x2ff6b
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x169b4
movq %rax, (%rsp)
movl $0x50, %edi
callq 0x61a1
movq %rax, %r14
movl $0x4, %eax
movl %eax, (%r14)
movabsq $0x1d0000011c, %r13     # imm = 0x1D0000011C
movq %r13, 0x18(%r14)
leaq 0x18e52(%rip), %rbp     # 0x2fe3d
movq %rbp, 0x8(%r14)
movq %r15, 0x40(%r14)
callq 0x101ad
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x169b4
movq %rax, 0x8(%rsp)
movl $0x50, %edi
callq 0x61a1
movq %rax, %r12
movl $0x4, %eax
movl %eax, (%r12)
movq %r13, 0x18(%r12)
movq %rbp, 0x8(%r12)
movq %r15, 0x40(%r12)
movq %r14, %rdi
callq 0x16a77
movq %r12, %rdi
callq 0x16abd
movq 0x58dfe(%rip), %r15     # 0x6fe48
movq 0x58e6f(%rip), %rbp     # 0x6fec0
testq %rbp, %rbp
je 0x17082
movq 0x68(%rbp), %rax
movq %rax, 0x58e5f(%rip)     # 0x6fec0
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rbp)
movups %xmm0, 0x50(%rbp)
movups %xmm0, 0x40(%rbp)
movups %xmm0, 0x30(%rbp)
movups %xmm0, 0x20(%rbp)
movups %xmm0, 0x10(%rbp)
movups %xmm0, (%rbp)
jmp 0x1708f
movl $0x70, %edi
callq 0x61a1
movq %rax, %rbp
movq 0x10(%r15), %rax
movq %rax, 0x68(%rbp)
movq %rbp, 0x10(%r15)
movq 0x48(%rbx), %rax
movq %rax, (%rbp)
movq 0x58d9e(%rip), %r13     # 0x6fe48
movq 0x58e0f(%rip), %r15     # 0x6fec0
testq %r15, %r15
je 0x170e8
movq 0x68(%r15), %rax
movq %rax, 0x58dff(%rip)     # 0x6fec0
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%r15)
movups %xmm0, 0x50(%r15)
movups %xmm0, 0x40(%r15)
movups %xmm0, 0x30(%r15)
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
jmp 0x170f5
movl $0x70, %edi
callq 0x61a1
movq %rax, %r15
movq 0x10(%r13), %rax
movq %rax, 0x68(%r15)
movq %r15, 0x10(%r13)
movq %r12, (%r15)
movq 0x58dbd(%rip), %r12     # 0x6fec8
testq %r12, %r12
je 0x1712c
movq 0x18(%r12), %rax
movq %rax, 0x58dac(%rip)     # 0x6fec8
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12)
movups %xmm0, (%r12)
jmp 0x17139
movl $0x20, %edi
callq 0x61a1
movq %rax, %r12
leaq 0x18c40(%rip), %rdi     # 0x2fd80
callq 0x1022e
movq %rax, (%r12)
movq %rbp, 0x10(%r12)
movq 0x58d73(%rip), %rax     # 0x6fec8
testq %rax, %rax
je 0x17171
movq 0x18(%rax), %rcx
movq %rcx, 0x58d63(%rip)     # 0x6fec8
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
jmp 0x1717b
movl $0x20, %edi
callq 0x61a1
movq %rax, 0x18(%r12)
leaq 0x18bf1(%rip), %rdi     # 0x2fd78
callq 0x1022e
movq 0x18(%r12), %rcx
movq %rax, (%rcx)
movq %r15, 0x10(%rcx)
movq 0x10(%rsp), %rdi
movq (%rsp), %rsi
callq 0x15e11
movq %rax, %r13
movl $0x58, %edi
callq 0x61a1
movl $0x2, (%rax)
movl $0x1b, 0x1c(%rax)
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movl 0x10(%rbx), %ecx
movl %ecx, 0x10(%rax)
movq 0x40(%rbx), %rcx
movq 0x28(%rcx), %rdx
movq %rdx, 0x28(%rax)
movq %rcx, 0x40(%rax)
movq (%rbp), %rcx
movq %rcx, 0x48(%rax)
movq (%r15), %rcx
movq %rcx, 0x50(%rax)
movq %r13, %rdi
movq %rax, %rsi
callq 0x16b0a
movq %r12, 0x50(%rax)
movq (%rbp), %rsi
movq %rbp, %rdi
callq 0x15e11
movq %rax, %rdi
movq %r14, %rsi
callq 0x15e11
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x15e11
movq %rax, %rbx
xorl %edi, %edi
cmpq $0x0, 0x58cc3(%rip)     # 0x6fef0
setne %dil
leaq 0x18c54(%rip), %rsi     # 0x2fe8c
callq 0x13f8c
movq 0x58cac(%rip), %rax     # 0x6fef0
movq 0x10(%rax), %rcx
movq %rcx, 0x58ca1(%rip)     # 0x6fef0
movq 0x58c8a(%rip), %rcx     # 0x6fee0
movq %rcx, 0x10(%rax)
movq %rax, 0x58c7f(%rip)     # 0x6fee0
xorl %edi, %edi
cmpq $0x0, 0x58c8d(%rip)     # 0x6fef8
setne %dil
leaq 0x18c2c(%rip), %rsi     # 0x2fea2
callq 0x13f8c
movq 0x58c76(%rip), %rax     # 0x6fef8
movq 0x10(%rax), %rcx
movq %rcx, 0x58c6b(%rip)     # 0x6fef8
movq 0x58c4c(%rip), %rcx     # 0x6fee0
movq %rcx, 0x10(%rax)
movq %rax, 0x58c41(%rip)     # 0x6fee0
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq