// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x78, %rsp
movl %esi, %ebp
movq %rdi, %r14
callq 0x7994
testb %al, %al
je 0xda37
movq %r14, %rdi
callq 0x6747
movq %rax, %rbx
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x27715
movb 0x8(%rbx), %al
cmpb $0x1, %bpl
jne 0xda48
movl %eax, %ecx
andb $-0x4, %cl
incb %cl
movb %cl, 0x8(%rbx)
leaq 0x8(%rsp), %rdi
testb $0x4, %al
movl $0x168, %ebp            # imm = 0x168
movl $0x0, %eax
cmovel %ebp, %eax
movq %r14, (%rdi)
cmovnel %ebp, %r15d
movl %eax, 0x20(%rdi)
movl %r15d, 0x24(%rdi)
leaq 0x18b(%rip), %rax       # 0xdb46
movq %rax, 0x8(%rdi)
leaq 0x19eb3(%rip), %r15     # 0x27879
movq %r15, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
andw $0x0, 0x2a(%rdi)
movzwl 0x6(%rbx), %eax
movw %ax, 0x28(%rdi)
andl $0x0, 0x2c(%rdi)
movb $0x2, 0x30(%rdi)
callq 0x27685
leaq 0x40(%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 0xbc(%rip), %rax        # 0xdacc
movq %rax, 0x8(%rdi)
movq %r15, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
andw $0x0, 0x2a(%rdi)
movzwl 0x6(%rbx), %eax
movw %ax, 0x28(%rdi)
andl $0x0, 0x2c(%rdi)
movb $-0x1, 0x30(%rdi)
jmp 0xdabc
leaq 0x2d706(%rip), %rdi     # 0x3b144
movq %r14, %rsi
callq 0x7b01
jmp 0xda46
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, 0x8(%rsp)
cmovel %r15d, %eax
movl %ecx, 0x28(%rsp)
movl %eax, 0x2c(%rsp)
leaq 0xc8(%rip), %rax        # 0xdb46
movq %rax, 0x10(%rsp)
cmpb $0x2, %bpl
jne 0xda92
leaq 0x19bc9(%rip), %rax     # 0x27659
jmp 0xda99
leaq 0x19de0(%rip), %rax     # 0x27879
leaq 0x8(%rsp), %rdi
movq %rax, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
andw $0x0, 0x2a(%rdi)
movzwl 0x6(%rbx), %eax
movw %ax, 0x28(%rdi)
andl $0x0, 0x2c(%rdi)
movb $0x2, 0x30(%rdi)
callq 0x27685
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq