// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/linearize.c
// Function: linearize_iterator
static pseudo_t linearize_iterator(struct entrypoint *ep, struct statement *stmt)
{
	struct statement  *pre_statement = stmt->iterator_pre_statement;
	struct expression *pre_condition = stmt->iterator_pre_condition;
	struct statement  *statement = stmt->iterator_statement;
	struct statement  *post_statement = stmt->iterator_post_statement;
	struct expression *post_condition = stmt->iterator_post_condition;
	struct basic_block *loop_top, *loop_body, *loop_continue, *loop_end;
	struct symbol *sym;

	FOR_EACH_PTR(stmt->iterator_syms, sym) {
		linearize_one_symbol(ep, sym);
	} END_FOR_EACH_PTR(sym);
	concat_symbol_list(stmt->iterator_syms, &ep->syms);
	linearize_statement(ep, pre_statement);

	loop_body = loop_top = alloc_basic_block(ep, stmt->pos);
	loop_continue = alloc_basic_block(ep, stmt->pos);
	loop_end = alloc_basic_block(ep, stmt->pos);

	/* An empty post-condition means that it's the same as the pre-condition */
	if (!post_condition) {
		loop_top = alloc_basic_block(ep, stmt->pos);
		set_activeblock(ep, loop_top);
	}

	if (pre_condition)
			linearize_cond_branch(ep, pre_condition, loop_body, loop_end);

	bind_label(stmt->iterator_continue, loop_continue, stmt->pos);
	bind_label(stmt->iterator_break, loop_end, stmt->pos);

	set_activeblock(ep, loop_body);
	linearize_statement(ep, statement);
	add_goto(ep, loop_continue);

	set_activeblock(ep, loop_continue);
	linearize_statement(ep, post_statement);
	if (!post_condition)
		add_goto(ep, loop_top);
	else
		linearize_cond_branch(ep, post_condition, loop_top, loop_end);
	set_activeblock(ep, loop_end);

	return VOID;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x1ec24
jmp 0x1ec9d
jmp 0x1ec26
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x70(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x1ec89
movq -0x70(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x70(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x1ec71
cmpq $0x0, -0x60(%rbp)
jne 0x1ec71
jmp 0x1ec7e
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x1bf90
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x1ec2d
jmp 0x1ec8b
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
cmpq -0x68(%rbp), %rax
jne 0x1ec26
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
callq 0x1b600
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1c230
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x4(%rax), %rsi
callq 0x1b110
movq %rax, -0x40(%rbp)
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x4(%rax), %rsi
callq 0x1b110
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x4(%rax), %rsi
callq 0x1b110
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1ed2b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x4(%rax), %rsi
callq 0x1b110
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1b170
cmpq $0x0, -0x20(%rbp)
je 0x1ed47
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x1e690
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x50(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x4(%rax), %rdx
callq 0x1f3f0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x58(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x4(%rax), %rdx
callq 0x1f3f0
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1b170
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1c230
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1b930
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x1b170
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x1c230
cmpq $0x0, -0x38(%rbp)
jne 0x1edd0
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1b930
jmp 0x1ede5
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x1e690
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x1b170
leaq 0x6cfb7(%rip), %rax     # 0x8bdb0
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)