// File: /workspace/github_c_makefile_star2_O1/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 0x3f220(%rip), %rdi     # 0x68558
callq 0x29cce
testq %rax, %rax
je 0x2935d
leaq 0x3f20f(%rip), %rbx     # 0x68558
andb $-0x9, 0x30(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x29dfb
testq %rax, %rax
jne 0x29349
movl 0x37159(%rip), %edi     # 0x604bc
callq 0x8855
movl %eax, %ebx
leaq 0x3f1e7(%rip), %rdi     # 0x68558
callq 0x29cce
testq %rax, %rax
je 0x294a8
movq %rax, %r15
leaq 0x3f1cf(%rip), %r14     # 0x68558
movq %rsp, %r12
movb $0x0, 0x3712d(%rip)     # 0x604c0
movb 0x30(%r15), %al
testb $0x8, %al
jne 0x2947e
orb $0x8, %al
movb %al, 0x30(%r15)
movzwl 0x2a(%r15), %eax
addw %bx, %ax
movw %ax, 0x2a(%r15)
js 0x2947e
movzwl 0x28(%r15), %ecx
cmpw %cx, %ax
jbe 0x293c7
movw %cx, 0x2a(%r15)
movq %r15, %rdi
callq *0x10(%r15)
movq 0x8(%r15), %rcx
testq %rcx, %rcx
je 0x293df
movq (%r15), %rdi
movswl %ax, %esi
callq *%rcx
movswl 0x2a(%r15), %eax
movzwl 0x28(%r15), %ecx
cmpl %ecx, %eax
jl 0x2947e
movb 0x30(%r15), %al
testb $0x3, %al
je 0x29403
movl %eax, %ecx
andb $0x7, %cl
cmpb $0x5, %cl
jne 0x29453
movq 0x30(%r15), %rax
movq %rax, 0x30(%rsp)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x29d38
movq %r15, %rdi
callq 0x29984
movb $0x1, 0x3707e(%rip)     # 0x604c0
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x2947e
movq %r12, %rdi
callq *%rax
jmp 0x2947e
xorl %ecx, %ecx
subw 0x2e(%r15), %cx
movw %cx, 0x2a(%r15)
testb $0x1, %al
je 0x2947e
testb $0x4, %al
jne 0x29473
xorl %ecx, %ecx
subw 0x2c(%r15), %cx
movw %cx, 0x2a(%r15)
xorb $0x4, %al
movb %al, 0x30(%r15)
rolq $0x20, 0x20(%r15)
cmpb $0x1, 0x3703b(%rip)     # 0x604c0
jne 0x29491
movq %r14, %rdi
callq 0x29cce
jmp 0x2949c
movq %r14, %rdi
movq %r15, %rsi
callq 0x29dfb
movq %rax, %r15
testq %rax, %rax
jne 0x2938c
callq 0x883e
movl %eax, 0x37009(%rip)     # 0x604bc
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq