// File: /workspace/github_c_makefile_star2_O1/bobrippling[P]tim/list.c
// Function: list_iter_region
void list_iter_region(
		list_t *l, const region_t *r,
		enum list_iter_flags flags,
		list_iter_f fn, void *ctx)
{
	size_t i = 0;
	size_t end = r->end.y - r->begin.y + 1;

	for(l = list_seek(l, r->begin.y, false);
			l && i < end; l = l->next, i++)
	{
		const size_t y = i + r->begin.y;
		bool next = true;

		switch(r->type){
			case REGION_LINE:
				if(flags & LIST_ITER_WHOLE_LINE)
					next = fn(l->line, l, y, ctx);
				else
					next = line_iter(l, 0, l->len_line, y, fn, ctx);
				break;
			case REGION_COL:
				next = line_iter(l, r->begin.x, r->end.x, y, fn, ctx);
				break;
			case REGION_CHAR:
				next = line_iter(l,
						i == 0 ? r->begin.x : 0,
						i+1 == end ? (unsigned)r->end.x : l->len_line,
						y, fn, ctx);
				break;
		}
		if(flags & LIST_ITER_EVAL_NL)
			list_evalnewlines1(l);
		if(!next)
			break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x10(%rsp)
movq %rcx, %r14
movl %edx, %r13d
movq %rsi, %rbx
movl 0x4(%rsi), %ecx
movl 0xc(%rsi), %eax
movq %rdi, 0x20(%rsp)
testq %rdi, %rdi
je 0xac47
testl %ecx, %ecx
jle 0xac4b
leal 0x1(%rcx), %esi
leaq 0x20(%rsp), %rdx
movq (%rdx), %rdx
cmpq $0x0, 0x18(%rdx)
je 0xac47
addq $0x18, %rdx
decl %esi
cmpl $0x1, %esi
jg 0xac30
jmp 0xac50
xorl %edx, %edx
jmp 0xac50
leaq 0x20(%rsp), %rdx
incl %eax
testq %rdx, %rdx
je 0xac5c
movq (%rdx), %r12
jmp 0xac5f
xorl %r12d, %r12d
testq %r12, %r12
setne %dl
cmpl %ecx, %eax
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0xadeb
subl %ecx, %eax
cltq
movq %rax, 0x18(%rsp)
xorl %r15d, %r15d
movl %r13d, 0x4(%rsp)
movq %rbx, 0x8(%rsp)
movl 0x4(%rbx), %ebp
movl 0x10(%rbx), %eax
addq %r15, %rbp
testl %eax, %eax
je 0xad40
cmpl $0x1, %eax
je 0xacfc
cmpl $0x2, %eax
jne 0xadad
testb $0x2, %r13b
jne 0xad4a
movq 0x8(%r12), %rbx
testq %rbx, %rbx
je 0xada8
xorl %r13d, %r13d
cmpq 0x8(%r12), %r13
jae 0xada3
movq (%r12), %rdi
addq %r13, %rdi
movq %r12, %rsi
movl %ebp, %edx
movq 0x10(%rsp), %rcx
callq *%r14
testb %al, %al
je 0xaddd
incq %r13
cmpq %r13, %rbx
jne 0xacc8
jmp 0xada3
movq %rbx, %rax
movslq (%rbx), %rbx
movslq 0x8(%rax), %r13
cmpl %r13d, %ebx
jae 0xada3
cmpq 0x8(%r12), %rbx
jae 0xada3
movq (%r12), %rdi
addq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
movq 0x10(%rsp), %rcx
callq *%r14
testb %al, %al
je 0xaddd
incq %rbx
cmpq %rbx, %r13
jne 0xad0f
jmp 0xada3
testq %r15, %r15
je 0xad5f
xorl %r13d, %r13d
jmp 0xad62
movq (%r12), %rdi
movq %r12, %rsi
movl %ebp, %edx
movq 0x10(%rsp), %rcx
callq *%r14
movl %eax, %ebp
jmp 0xadb0
movslq (%rbx), %r13
leaq 0x1(%r15), %rax
cmpq 0x18(%rsp), %rax
jne 0xad72
movl 0x8(%rbx), %ebx
jmp 0xad77
movq 0x8(%r12), %rbx
cmpq %rbx, %r13
jae 0xada3
cmpq 0x8(%r12), %r13
jae 0xada3
movq (%r12), %rdi
addq %r13, %rdi
movq %r12, %rsi
movl %ebp, %edx
movq 0x10(%rsp), %rcx
callq *%r14
testb %al, %al
je 0xaddd
incq %r13
cmpq %r13, %rbx
jne 0xad7c
movl 0x4(%rsp), %r13d
movq 0x8(%rsp), %rbx
movb $0x1, %bpl
testb $0x1, %r13b
je 0xadbe
movq %r12, %rdi
callq 0x9efb
testb %bpl, %bpl
je 0xadeb
movq 0x18(%r12), %r12
testq %r12, %r12
je 0xadeb
incq %r15
cmpq 0x18(%rsp), %r15
jb 0xac8e
jmp 0xadeb
xorl %ebp, %ebp
movl 0x4(%rsp), %r13d
movq 0x8(%rsp), %rbx
jmp 0xadb0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq