// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_anim.c
// Function: anim_task
static void anim_task(lv_task_t * param)
{
    (void)param;

    lv_anim_t * a;
    LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a)
    {
        a->has_run = 0;
    }

    uint32_t elaps = lv_tick_elaps(last_task_run);

    a = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));

    while(a != NULL) {
        /*It can be set by `lv_anim_del()` typically in `end_cb`. If set then an animation delete
         * happened in `anim_ready_handler` which could make this linked list reading corrupt
         * because the list is changed meanwhile
         */
        anim_list_changed = false;

        if(!a->has_run) {
            a->has_run = 1; /*The list readying might be reseted so need to know which anim has run already*/
            a->act_time += elaps;
            if(a->act_time >= 0) {
                if(a->act_time > a->time) a->act_time = a->time;

                int32_t new_value;
                new_value = a->path_cb(a);

                /*Apply the calculated value*/
                if(a->exec_cb) a->exec_cb(a->var, new_value);

                /*If the time is elapsed the animation is ready*/
                if(a->act_time >= a->time) {
                    anim_ready_handler(a);
                }
            }
        }

        /* If the linked list changed due to anim. delete then it's not safe to continue
         * the reading of the list from here -> start from the head*/
        if(anim_list_changed)
            a = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
        else
            a = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
    }

    last_task_run = lv_tick_get();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x3f0ce(%rip), %rbx     # 0x66558
movq %rbx, %rdi
callq 0x27db9
testq %rax, %rax
je 0x274a8
andb $-0x9, 0x30(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x27e93
jmp 0x27492
movl 0x3700e(%rip), %edi     # 0x5e4bc
callq 0x8031
movl %eax, %ebx
leaq 0x3f09c(%rip), %r14     # 0x66558
movq %r14, %rdi
callq 0x27db9
movq %rax, %r12
movq %rsp, %r15
testq %r12, %r12
je 0x27616
movb $0x0, 0x36fe6(%rip)     # 0x5e4c0
movb 0x30(%r12), %al
testb $0x8, %al
jne 0x27603
orb $0x8, %al
movb %al, 0x30(%r12)
movzwl 0x2a(%r12), %eax
addw %bx, %ax
movw %ax, 0x2a(%r12)
js 0x275ea
movzwl 0x28(%r12), %ecx
cmpw %cx, %ax
jbe 0x27514
movw %cx, 0x2a(%r12)
movq %r12, %rdi
callq *0x10(%r12)
movq 0x8(%r12), %rcx
testq %rcx, %rcx
je 0x2752f
movq (%r12), %rdi
movswl %ax, %esi
callq *%rcx
movswl 0x2a(%r12), %eax
movzwl 0x28(%r12), %ecx
cmpl %ecx, %eax
jl 0x275ea
movb 0x30(%r12), %al
testb $0x3, %al
je 0x27556
movl %eax, %ecx
andb $0x7, %cl
cmpb $0x5, %cl
jne 0x275ac
movq 0x30(%r12), %rax
movq %rax, 0x30(%rsp)
movdqu (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups 0x20(%r12), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movdqa %xmm0, (%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x27e1c
movq %r12, %rdi
callq 0x27a7a
movb $0x1, 0x36f25(%rip)     # 0x5e4c0
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x275ea
movq %r15, %rdi
callq *%rax
jmp 0x275ea
xorl %ecx, %ecx
subw 0x2e(%r12), %cx
movw %cx, 0x2a(%r12)
testb $0x1, %al
je 0x275ea
testb $0x4, %al
jne 0x275d0
xorl %ecx, %ecx
subw 0x2c(%r12), %cx
movw %cx, 0x2a(%r12)
xorb $0x4, %al
movb %al, 0x30(%r12)
movq 0x20(%r12), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x20(%r12)
cmpb $0x1, 0x36ecf(%rip)     # 0x5e4c0
jne 0x27603
movq %r14, %rdi
callq 0x27db9
movq %rax, %r12
jmp 0x274ca
movq %r14, %rdi
movq %r12, %rsi
callq 0x27e93
movq %rax, %r12
jmp 0x274ca
callq 0x801a
movl %eax, 0x36e9b(%rip)     # 0x5e4bc
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq