// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_preload.c
// Function: lv_preload_set_type
void lv_preload_set_type(lv_obj_t * preload, lv_preload_type_t type)
{
    LV_ASSERT_OBJ(preload, LV_OBJX_NAME);

    lv_preload_ext_t * ext = lv_obj_get_ext_attr(preload);

    /*delete previous animation*/
    lv_anim_del(preload, NULL);
    switch(type) {
        case LV_PRELOAD_TYPE_FILLSPIN_ARC: {
            ext->anim_type = LV_PRELOAD_TYPE_FILLSPIN_ARC;
            lv_anim_t a;
            a.var = preload;
            if(ext->anim_dir == LV_PRELOAD_DIR_FORWARD) {
                /* Clockwise */
                a.start = 360;
                a.end   = 0;
            } else {
                a.start = 0;
                a.end   = 360;
            }
            a.exec_cb        = (lv_anim_exec_xcb_t)lv_preload_spinner_anim;
            a.path_cb        = lv_anim_path_ease_in_out;
            a.ready_cb       = NULL;
            a.act_time       = 0;
            a.time           = ext->time;
            a.playback       = 0;
            a.playback_pause = 0;
            a.repeat         = 1;
            a.repeat_pause   = 0;
            lv_anim_create(&a);

            lv_anim_t b;
            b.var = preload;
            if(ext->anim_dir == LV_PRELOAD_DIR_FORWARD) {
                /* Clockwise */
                b.start = 360 - ext->arc_length;
                b.end   = ext->arc_length;
            } else {
                b.start = ext->arc_length;
                b.end   = 360 - ext->arc_length;
            }
            b.exec_cb        = (lv_anim_exec_xcb_t)lv_preload_set_arc_length;
            b.path_cb        = lv_anim_path_ease_in_out;
            b.ready_cb       = NULL;
            b.act_time       = 0;
            b.time           = ext->time;
            b.playback       = 1;
            b.playback_pause = 0;
            b.repeat         = 1;
            b.repeat_pause   = 0;
            lv_anim_create(&b);
            break;
        }
        case LV_PRELOAD_TYPE_CONSTANT_ARC:
        case LV_PRELOAD_TYPE_SPINNING_ARC:
        default: {
            ext->anim_type = type;
            lv_anim_t a;
            a.var = preload;
            if(ext->anim_dir == LV_PRELOAD_DIR_FORWARD) {
                /* Clockwise */
                a.start = 360;
                a.end   = 0;
            } else {
                a.start = 0;
                a.end   = 360;
            }
            a.exec_cb        = (lv_anim_exec_xcb_t)lv_preload_spinner_anim;
            a.path_cb        = (LV_PRELOAD_TYPE_CONSTANT_ARC == type ?
                                lv_anim_path_linear : lv_anim_path_ease_in_out);
            a.ready_cb       = NULL;
            a.act_time       = 0;
            a.time           = ext->time;
            a.playback       = 0;
            a.playback_pause = 0;
            a.repeat         = 1;
            a.repeat_pause   = 0;
            lv_anim_create(&a);
            break;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movl %esi, %ebp
movq %rdi, %r14
callq 0x80e4
testb %al, %al
je 0xe4da
movq %r14, %rdi
callq 0x6af7
movq %rax, %rbx
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x29c44
movb 0x8(%rbx), %al
cmpb $0x1, %bpl
jne 0xe4eb
movl %eax, %ecx
andb $-0x4, %cl
incb %cl
movb %cl, 0x8(%rbx)
movq %rsp, %rdi
testb $0x4, %al
movl $0x168, %ebp            # imm = 0x168
movl $0x0, %eax
cmovel %ebp, %eax
movq %r14, (%rdi)
movl $0x168, %ecx            # imm = 0x168
cmovel %r15d, %ecx
movl %eax, 0x20(%rdi)
movl %ecx, 0x24(%rdi)
leaq 0x18f(%rip), %rax       # 0xe5ef
movq %rax, 0x8(%rdi)
leaq 0x1b959(%rip), %r12     # 0x29dc4
movq %r12, 0x10(%rdi)
movq %r15, 0x18(%rdi)
movw %r15w, 0x2a(%rdi)
movzwl 0x6(%rbx), %eax
movw %ax, 0x28(%rdi)
movl %r15d, 0x2c(%rdi)
movb $0x2, 0x30(%rdi)
callq 0x29bb4
leaq 0x38(%rsp), %rdi
movq %r14, (%rdi)
movswl 0x4(%rbx), %eax
subl %eax, %ebp
testb $0x4, 0x8(%rbx)
movl %eax, %ecx
cmovel %ebp, %ecx
cmovel %eax, %ebp
movl %ecx, 0x20(%rdi)
movl %ebp, 0x24(%rdi)
leaq 0xc1(%rip), %rax        # 0xe575
movq %rax, 0x8(%rdi)
movq %r12, 0x10(%rdi)
movq %r15, 0x18(%rdi)
movw %r15w, 0x2a(%rdi)
movzwl 0x6(%rbx), %eax
movw %ax, 0x28(%rdi)
movl %r15d, 0x2c(%rdi)
movb $-0x1, 0x30(%rdi)
jmp 0xe563
leaq 0x30d03(%rip), %rdi     # 0x3f1e4
movq %r14, %rsi
callq 0x8294
jmp 0xe4e9
movl %ebp, %ecx
andb $0x3, %cl
movl %eax, %edx
andb $-0x4, %dl
orb %cl, %dl
movb %dl, 0x8(%rbx)
testb $0x4, %al
movl $0x168, %eax            # imm = 0x168
movl $0x0, %ecx
cmovel %eax, %ecx
movq %r14, (%rsp)
cmovel %r15d, %eax
movl %ecx, 0x20(%rsp)
movl %eax, 0x24(%rsp)
leaq 0xcf(%rip), %rax        # 0xe5ef
movq %rax, 0x8(%rsp)
cmpb $0x2, %bpl
jne 0xe534
leaq 0x1b656(%rip), %rax     # 0x29b88
jmp 0xe53b
leaq 0x1b889(%rip), %rax     # 0x29dc4
movq %rsp, %rdi
movq %rax, 0x10(%rdi)
movq $0x0, 0x18(%rdi)
movw $0x0, 0x2a(%rdi)
movzwl 0x6(%rbx), %eax
movw %ax, 0x28(%rdi)
movl $0x0, 0x2c(%rdi)
movb $0x2, 0x30(%rdi)
callq 0x29bb4
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq