// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_sw.c
// Function: lv_sw_create
lv_obj_t * lv_sw_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("switch create started");

    /*Create the ancestor of switch*/
    lv_obj_t * new_sw = lv_slider_create(par, copy);
    LV_ASSERT_MEM(new_sw);
    if(new_sw == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_sw);

    /*Allocate the switch type specific extended data*/
    lv_sw_ext_t * ext = lv_obj_allocate_ext_attr(new_sw, sizeof(lv_sw_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    /*Initialize the allocated 'ext' */
    ext->changed = 0;
#if LV_USE_ANIMATION
    ext->anim_time = 0;
#endif
    ext->style_knob_off = ext->slider.style_knob;
    ext->style_knob_on  = ext->slider.style_knob;

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_sw, lv_sw_signal);

    /*Init the new switch switch*/
    if(copy == NULL) {
        lv_obj_set_size(new_sw, 2 * LV_DPI / 3, LV_DPI / 3);
        lv_slider_set_knob_in(new_sw, true);
        lv_slider_set_range(new_sw, 0, LV_SW_MAX_VALUE);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_sw_set_style(new_sw, LV_SW_STYLE_BG, th->style.sw.bg);
            lv_sw_set_style(new_sw, LV_SW_STYLE_INDIC, th->style.sw.indic);
            lv_sw_set_style(new_sw, LV_SW_STYLE_KNOB_OFF, th->style.sw.knob_off);
            lv_sw_set_style(new_sw, LV_SW_STYLE_KNOB_ON, th->style.sw.knob_on);
        } else {
            /*Let the slider' style*/
        }

    }
    /*Copy an existing switch*/
    else {
        lv_sw_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->style_knob_off    = copy_ext->style_knob_off;
        ext->style_knob_on     = copy_ext->style_knob_on;
#if LV_USE_ANIMATION
        ext->anim_time = copy_ext->anim_time;
#endif

        if(lv_sw_get_state(new_sw))
            lv_slider_set_style(new_sw, LV_SLIDER_STYLE_KNOB, ext->style_knob_on);
        else
            lv_slider_set_style(new_sw, LV_SLIDER_STYLE_KNOB, ext->style_knob_off);

        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_sw);
    }

    LV_LOG_INFO("switch created");

    return new_sw;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2ed10
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x3f6c0
movq -0x20(%rbp), %rsi
leaq 0x2898b(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x3f6be
cmpq $0x0, -0x20(%rbp)
jne 0x3f6d4
movq $0x0, -0x8(%rbp)
jmp 0x3f8be
cmpq $0x0, 0x49e6c(%rip)     # 0x89548
jne 0x3f6ee
movq -0x20(%rbp), %rdi
callq 0xa830
movq %rax, 0x49e5a(%rip)     # 0x89548
movq -0x20(%rbp), %rdi
movl $0x40, %esi
callq 0x9d60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x3f71f
movq -0x28(%rbp), %rsi
leaq 0x2892c(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x3f71d
cmpq $0x0, -0x28(%rbp)
jne 0x3f733
movq $0x0, -0x8(%rbp)
jmp 0x3f8be
movq -0x28(%rbp), %rax
movb 0x3a(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0x3a(%rax)
movq -0x28(%rbp), %rax
movw $0x0, 0x3c(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x20(%rbp), %rdi
leaq 0x158(%rip), %rsi       # 0x3f8d0
callq 0x9cc0
cmpq $0x0, -0x18(%rbp)
jne 0x3f833
movq -0x20(%rbp), %rdi
movl $0x42, %esi
movl $0x21, %edx
callq 0x8180
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0x30390
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0x64, %edx
callq 0x3fdb0
callq 0x4cfc0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3f82c
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0xf0(%rax), %rdx
xorl %esi, %esi
callq 0x3fdf0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0xf8(%rax), %rdx
movl $0x1, %esi
callq 0x3fdf0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x100(%rax), %rdx
movl $0x2, %esi
callq 0x3fdf0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x108(%rax), %rdx
movl $0x3, %esi
callq 0x3fdf0
jmp 0x3f82e
jmp 0x3f82e
jmp 0x3f8b6
movq -0x18(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x38(%rbp), %rax
movw 0x3c(%rax), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x3c(%rax)
movq -0x20(%rbp), %rdi
callq 0x3fef0
testb $0x1, %al
jne 0x3f87f
jmp 0x3f897
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rdx
movl $0x2, %esi
callq 0x302e0
jmp 0x3f8ad
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdx
movl $0x2, %esi
callq 0x302e0
movq -0x20(%rbp), %rdi
callq 0x9250
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)