// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_preload.c
// Function: lv_preload_create
lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("preload create started");

    /*Create the ancestor of pre loader*/
    lv_obj_t * new_preload = lv_arc_create(par, copy);
    LV_ASSERT_MEM(new_preload);
    if(new_preload == NULL) return NULL;

    /*Allocate the pre loader type specific extended data*/
    lv_preload_ext_t * ext = lv_obj_allocate_ext_attr(new_preload, sizeof(lv_preload_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_preload);
    if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_preload);

    /*Initialize the allocated 'ext' */
    ext->arc_length = LV_PRELOAD_DEF_ARC_LENGTH;
    ext->anim_type  = LV_PRELOAD_DEF_ANIM;
    ext->anim_dir   = LV_PRELOAD_DIR_FORWARD;

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_preload, lv_preload_signal);
    lv_obj_set_design_cb(new_preload, lv_preload_design);

    /*Init the new pre loader pre loader*/
    if(copy == NULL) {
        lv_obj_set_size(new_preload, LV_DPI / 2, LV_DPI / 2);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_preload_set_style(new_preload, LV_PRELOAD_STYLE_MAIN, th->style.preload);
        } else {
            lv_obj_set_style(new_preload, &lv_style_pretty_color);
        }

        ext->time = LV_PRELOAD_DEF_SPIN_TIME;

    }
    /*Copy an existing pre loader*/
    else {
        lv_preload_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->arc_length             = copy_ext->arc_length;
        ext->time                   = copy_ext->time;
        ext->anim_dir               = copy_ext->anim_dir;
        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_preload);
    }

    lv_preload_set_type(new_preload, ext->anim_type);

    LV_LOG_INFO("preload created");

    return new_preload;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
callq 0x8040
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0xd6f0
testq %rbx, %rbx
je 0xd701
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r14
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0xd705
testq %r14, %r14
je 0xd701
cmpq $0x0, 0x50c94(%rip)     # 0x5e300
jne 0xd67d
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x50c83(%rip)     # 0x5e300
cmpq $0x0, 0x50c83(%rip)     # 0x5e308
jne 0xd696
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x50c72(%rip)     # 0x5e308
movw $0x3c, 0x4(%r14)
andb $-0x8, 0x8(%r14)
leaq 0xc6(%rip), %rsi        # 0xd76f
movq %rbx, %rdi
callq 0x60e6
leaq 0xef(%rip), %rsi        # 0xd7a7
movq %rbx, %rdi
callq 0x6116
testq %r15, %r15
je 0xd716
movq %r15, %rdi
callq 0x6747
movl 0x4(%rax), %ecx
movl %ecx, 0x4(%r14)
movb 0x8(%rax), %al
andb $0x4, %al
movb 0x8(%r14), %cl
andb $-0x5, %cl
orb %al, %cl
movb %cl, 0x8(%r14)
movq %rbx, %rdi
callq 0x5ae7
jmp 0xd756
leaq 0x2d949(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0xd6ff
xorl %ebx, %ebx
jmp 0xd766
leaq 0x2d934(%rip), %rdi     # 0x3b040
movq %r14, %rsi
callq 0x7b01
jmp 0xd714
pushq $0x32
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
callq 0x520e
callq 0x2be75
testq %rax, %rax
je 0xd740
movq 0xe8(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xd906
jmp 0xd74f
leaq 0x508a9(%rip), %rsi     # 0x5dff0
movq %rbx, %rdi
callq 0x5a3d
movw $0x3e8, 0x6(%r14)       # imm = 0x3E8
movzbl 0x8(%r14), %esi
andl $0x3, %esi
movq %rbx, %rdi
callq 0xd947
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq