// File: /workspace/github_c_makefile_star2_O3/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 0x3eb94(%rip), %rdi     # 0x68558
callq 0x2a35c
testq %rax, %rax
je 0x299e9
leaq 0x3eb83(%rip), %rbx     # 0x68558
andb $-0x9, 0x30(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2a448
testq %rax, %rax
jne 0x299d5
movl 0x36acd(%rip), %edi     # 0x604bc
callq 0x87cd
movl %eax, %ebx
leaq 0x3eb5b(%rip), %rdi     # 0x68558
callq 0x2a35c
testq %rax, %rax
je 0x29b42
movq %rax, %r15
leaq 0x3eb43(%rip), %r14     # 0x68558
movq %rsp, %r12
movb $0x0, 0x36aa1(%rip)     # 0x604c0
movb 0x30(%r15), %al
testb $0x8, %al
jne 0x29b2b
orb $0x8, %al
movb %al, 0x30(%r15)
movzwl 0x2a(%r15), %eax
addw %bx, %ax
movw %ax, 0x2a(%r15)
js 0x29b18
movzwl 0x28(%r15), %ecx
cmpw %cx, %ax
jbe 0x29a53
movw %cx, 0x2a(%r15)
movq %r15, %rdi
callq *0x10(%r15)
movq 0x8(%r15), %rcx
testq %rcx, %rcx
je 0x29a6b
movq (%r15), %rdi
movswl %ax, %esi
callq *%rcx
movswl 0x2a(%r15), %eax
movzwl 0x28(%r15), %ecx
cmpl %ecx, %eax
jl 0x29b18
movb 0x30(%r15), %al
testb $0x3, %al
je 0x29a8f
movl %eax, %ecx
andb $0x7, %cl
cmpb $0x5, %cl
jne 0x29ae1
movq 0x30(%r15), %rax
movq %rax, 0x30(%rsp)
movdqu (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movaps %xmm2, 0x20(%rsp)
movaps %xmm1, 0x10(%rsp)
movdqa %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2a3c2
movq %r15, %rdi
callq 0x2a006
movb $0x1, 0x369f0(%rip)     # 0x604c0
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x29b18
movq %r12, %rdi
callq *%rax
jmp 0x29b18
xorl %ecx, %ecx
subw 0x2e(%r15), %cx
movw %cx, 0x2a(%r15)
testb $0x1, %al
je 0x29b18
testb $0x4, %al
jne 0x29b01
xorl %ecx, %ecx
subw 0x2c(%r15), %cx
movw %cx, 0x2a(%r15)
xorb $0x4, %al
movb %al, 0x30(%r15)
movq 0x20(%r15), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x20(%r15)
cmpb $0x1, 0x369a1(%rip)     # 0x604c0
jne 0x29b2b
movq %r14, %rdi
callq 0x2a35c
jmp 0x29b36
movq %r14, %rdi
movq %r15, %rsi
callq 0x2a448
movq %rax, %r15
testq %rax, %rax
jne 0x29a18
callq 0x87b6
movl %eax, 0x3696f(%rip)     # 0x604bc
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq