// File: /workspace/github_c_makefile_star2_O0/cglindkamp[P]dfm/src/listview.c
// Function: change_cb
static void change_cb(enum model_change change, size_t newindex, size_t oldindex, void *data)
{
	struct listview *view = data;
	unsigned int rowcount = getmaxy(view->window);

	switch(change) {
	case MODEL_ADD:
		if(newindex <= view->index)
			listview_setindex_internal(view, view->index + 1, 1, true);
		else if(newindex < view->first + rowcount)
			view->needs_refresh = true;
		break;
	case MODEL_REMOVE:
		if(oldindex < view->index)
			listview_setindex_internal(view, view->index - 1, -1, true);
		else if(oldindex < view->first + rowcount)
			listview_setindex_internal(view, view->index, 0, true);
		break;
	case MODEL_CHANGE:
		if(newindex == oldindex) {
			if(newindex >= view->first && newindex < view->first + rowcount)
				view->needs_refresh = true;
		} else if(oldindex == view->index) {
			listview_setindex_internal(view, newindex, 0, false);
		} else {
			change_cb(MODEL_ADD, newindex, oldindex, data);
			change_cb(MODEL_REMOVE, newindex, oldindex, data);
		}
		break;
	case MODEL_RELOAD:
		view->first = 0;
		view->index = 0;
		view->needs_refresh = true;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq (%rcx), %rax
je 0xb12d
movq -0x28(%rbp), %rax
movq (%rax), %rax
movswl 0x4(%rax), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xb137
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x30(%rbp)
jmp 0xb137
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x4(%rbp), %eax
movq %rax, -0x38(%rbp)
subq $0x3, %rax
ja 0xb2c0
movq -0x38(%rbp), %rax
leaq 0x2317(%rip), %rcx      # 0xd470
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x18(%rcx), %rax
ja 0xb18e
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
addq $0x1, %rsi
movl $0x1, %ecx
movl %ecx, %edx
callq 0xac40
jmp 0xb1af
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x2c(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0xb1ad
movq -0x28(%rbp), %rax
movb $0x1, 0x20(%rax)
jmp 0xb1af
jmp 0xb2c0
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jae 0xb1e3
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
subq $0x1, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x1, %ecx
callq 0xac40
jmp 0xb214
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x2c(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0xb212
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
xorl %edx, %edx
movl $0x1, %ecx
callq 0xac40
jmp 0xb214
jmp 0xb2c0
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0xb252
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0xb250
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x2c(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0xb250
movq -0x28(%rbp), %rax
movb $0x1, 0x20(%rax)
jmp 0xb29e
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jne 0xb273
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0xac40
jmp 0xb29c
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
xorl %edi, %edi
callq 0xb0f0
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x1, %edi
callq 0xb0f0
jmp 0xb29e
jmp 0xb2c0
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x28(%rbp), %rax
movb $0x1, 0x20(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)