// File: /workspace/github_c_makefile_star2_O0/cglindkamp[P]dfm/src/listview.c
// Function: listview_refresh
void listview_refresh(struct listview *view)
{
	if(!view->needs_refresh)
		return;

	unsigned int height, width;
	size_t i = 0;
	height = getmaxy(view->window);
	width = getmaxx(view->window);

	size_t buflen = width;

	werase(view->window);
	while(i < height) {
		if(i + view->first >= listmodel_count(view->model))
			break;

		wchar_t buffer[buflen + 1];
		size_t reallen = listmodel_render(view->model, buffer, buflen, width, i + view->first);

		if(reallen > buflen) {
			buflen = reallen;
			continue;
		}

		int attrs = attrs_for_index(view->model, view->first + i, view->index);

		wmove(view->window, i, 0);
		wattron(view->window, attrs);
		waddwstr(view->window, buffer);
		wattroff(view->window, attrs);

		i++;
	}
	wrefresh(view->window);
	view->needs_refresh = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
testb $0x1, 0x20(%rax)
jne 0xa9ab
jmp 0xab86
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq (%rcx), %rax
je 0xa9d1
movq -0x8(%rbp), %rax
movq (%rax), %rax
movswl 0x4(%rax), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xa9db
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x44(%rbp)
jmp 0xa9db
movl -0x44(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rcx
xorl %eax, %eax
cmpq (%rcx), %rax
je 0xa9ff
movq -0x8(%rbp), %rax
movq (%rax), %rax
movswl 0x6(%rax), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xaa09
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x48(%rbp)
jmp 0xaa09
movl -0x48(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x30e0
movq -0x18(%rbp), %rax
movl -0xc(%rbp), %ecx
cmpq %rcx, %rax
jae 0xab72
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
addq 0x10(%rcx), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa660
movq %rax, %rcx
movq -0x50(%rbp), %rax
cmpq %rcx, %rax
jb 0xaa60
jmp 0xab72
movq -0x20(%rbp), %rcx
movq %rcx, %rax
incq %rax
movq %rsp, %rdx
movq %rdx, -0x28(%rbp)
leaq 0x13(,%rcx,4), %rcx
andq $-0x10, %rcx
movq %rsp, %rsi
subq %rcx, %rsi
movq %rsi, -0x58(%rbp)
movq %rsi, %rsp
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x10(%rbp), %eax
movl %eax, %ecx
movq -0x18(%rbp), %r8
movq -0x8(%rbp), %rax
addq 0x10(%rax), %r8
callq 0xa680
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x20(%rbp), %rax
jbe 0xaad2
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x2, -0x3c(%rbp)
jmp 0xab58
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
addq -0x18(%rbp), %rsi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdx
callq 0xab90
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movl %eax, %esi
xorl %edx, %edx
callq 0x3090
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x40(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3120
movq -0x58(%rbp), %rsi
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x32d0
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x40(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3620
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rsp
movl -0x3c(%rbp), %eax
testl %eax, %eax
je 0xab6d
jmp 0xab68
jmp 0xaa22
jmp 0xaa22
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x3390
movq -0x8(%rbp), %rax
movb $0x0, 0x20(%rax)
movq %rbp, %rsp
popq %rbp
retq
nopl (%rax,%rax)