// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_ddlist.c
// Function: lv_ddlist_create
lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("drop down list create started");

    /*Create the ancestor drop down list*/
    lv_obj_t * new_ddlist = lv_page_create(par, copy);
    LV_ASSERT_MEM(new_ddlist);
    if(new_ddlist == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_ddlist);
    if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrl(new_ddlist));
    if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_ddlist);

    /*Allocate the drop down list type specific extended data*/
    lv_ddlist_ext_t * ext = lv_obj_allocate_ext_attr(new_ddlist, sizeof(lv_ddlist_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    /*Initialize the allocated 'ext' */
    ext->label          = NULL;
    ext->opened         = 0;
    ext->fix_height     = 0;
    ext->sel_opt_id     = 0;
    ext->sel_opt_id_ori = 0;
    ext->option_cnt     = 0;
    ext->sel_style      = &lv_style_plain_color;
    ext->draw_arrow     = 0; /*Do not draw arrow by default*/
    ext->stay_open      = 0;

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_ddlist, lv_ddlist_signal);
    lv_obj_set_signal_cb(lv_page_get_scrl(new_ddlist), lv_ddlist_scrl_signal);
    lv_obj_set_design_cb(new_ddlist, lv_ddlist_design);

    /*Init the new drop down list drop down list*/
    if(copy == NULL) {
        lv_page_set_anim_time(new_ddlist, LV_DDLIST_DEF_ANIM_TIME);

        lv_obj_t * scrl = lv_page_get_scrl(new_ddlist);
        lv_obj_set_drag(scrl, false);
        lv_page_set_scrl_fit2(new_ddlist, LV_FIT_FILL, LV_FIT_TIGHT);

        /*Save (a later restore) the original X coordinate because it changes as the FITs applies*/
        lv_coord_t x;
        if(lv_obj_get_base_dir(new_ddlist) == LV_BIDI_DIR_RTL) x = lv_obj_get_x(new_ddlist) + lv_obj_get_width(new_ddlist);
        else x = lv_obj_get_x(new_ddlist);

        ext->label = lv_label_create(new_ddlist, NULL);
        lv_cont_set_fit2(new_ddlist, LV_FIT_TIGHT, LV_FIT_NONE);
        lv_page_set_sb_mode(new_ddlist, LV_SB_MODE_HIDE);
        lv_page_set_style(new_ddlist, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);

        lv_ddlist_set_options(new_ddlist, "Option 1\nOption 2\nOption 3");

        /*Restore the original X coordinate*/
        if(lv_obj_get_base_dir(new_ddlist) == LV_BIDI_DIR_RTL) lv_obj_set_x(new_ddlist, x - lv_obj_get_width(new_ddlist));
        else lv_obj_set_x(new_ddlist, x);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_BG, th->style.ddlist.bg);
            lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SEL, th->style.ddlist.sel);
            lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SB, th->style.ddlist.sb);
        } else {
            lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_BG, &lv_style_pretty);
            lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SEL, &lv_style_plain_color);
            lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SB, &lv_style_pretty_color);
        }


    }
    /*Copy an existing drop down list*/
    else {
        lv_ddlist_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->label                 = lv_label_create(new_ddlist, copy_ext->label);
        lv_label_set_text(ext->label, lv_label_get_text(copy_ext->label));
        ext->sel_opt_id     = copy_ext->sel_opt_id;
        ext->sel_opt_id_ori = copy_ext->sel_opt_id;
        ext->fix_height     = copy_ext->fix_height;
        ext->option_cnt     = copy_ext->option_cnt;
        ext->sel_style      = copy_ext->sel_style;
        ext->draw_arrow     = copy_ext->draw_arrow;
        ext->stay_open      = copy_ext->stay_open;

        lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_BG, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_BG));
        lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SB, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_SB));
        lv_ddlist_set_style(new_ddlist, LV_DDLIST_STYLE_SEL, lv_ddlist_get_style(copy, LV_DDLIST_STYLE_SEL));

    }

    LV_LOG_INFO("drop down list created");

    return new_ddlist;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
callq 0x24c9c
movq %rax, %rbx
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0xb60a
testq %rbx, %rbx
je 0xb61b
cmpq $0x0, 0x54e81(%rip)     # 0x602d0
jne 0xb460
movq %rbx, %rdi
callq 0x6a6c
movq %rax, 0x54e70(%rip)     # 0x602d0
cmpq $0x0, 0x54e70(%rip)     # 0x602d8
jne 0xb481
movq %rbx, %rdi
callq 0x26288
movq %rax, %rdi
callq 0x6a6c
movq %rax, 0x54e57(%rip)     # 0x602d8
cmpq $0x0, 0x54e57(%rip)     # 0x602e0
jne 0xb49a
movq %rbx, %rdi
callq 0x6a90
movq %rax, 0x54e46(%rip)     # 0x602e0
movq %rbx, %rdi
movl $0x70, %esi
callq 0x64bc
movq %rax, %r15
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0xb622
testq %r15, %r15
je 0xb61b
movq $0x0, 0x50(%r15)
xorl %eax, %eax
movw %ax, 0x68(%r15)
movw %ax, 0x64(%r15)
movl $0x0, 0x60(%r15)
leaq 0x54a7a(%rip), %rax     # 0x5ff60
movq %rax, 0x58(%r15)
andb $-0xe, 0x66(%r15)
leaq 0x2a2(%rip), %rsi       # 0xb798
movq %rbx, %rdi
callq 0x645c
movq %rbx, %rdi
callq 0x26288
leaq 0x464(%rip), %rsi       # 0xb971
movq %rax, %rdi
callq 0x645c
leaq 0x4e9(%rip), %rsi       # 0xba05
movq %rbx, %rdi
callq 0x648c
testq %r14, %r14
je 0xb633
movq %r14, %rdi
callq 0x6ad8
movq %rax, %r12
movq 0x50(%rax), %rsi
movq %rbx, %rdi
callq 0x196f4
movq %rax, %r13
movq %rax, 0x50(%r15)
movq 0x50(%r12), %rdi
callq 0x1a239
movq %r13, %rdi
movq %rax, %rsi
callq 0x19f13
movzwl 0x62(%r12), %eax
movw %ax, 0x62(%r15)
movzwl 0x62(%r12), %eax
movw %ax, 0x64(%r15)
movzwl 0x68(%r12), %eax
movw %ax, 0x68(%r15)
movzwl 0x60(%r12), %eax
movw %ax, 0x60(%r15)
movq 0x58(%r12), %rax
movq %rax, 0x58(%r15)
movb 0x66(%r12), %al
andb $0x4, %al
movb 0x66(%r15), %cl
andb $-0x5, %cl
orb %al, %cl
movb %cl, 0x66(%r15)
movb 0x66(%r12), %al
andb $0x8, %al
andb $-0x9, %cl
orb %al, %cl
movb %cl, 0x66(%r15)
movq %r14, %rdi
xorl %esi, %esi
callq 0xbf18
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xbe8d
movq %r14, %rdi
movl $0x2, %esi
callq 0xbf18
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0xbe8d
movq %r14, %rdi
movl $0x1, %esi
callq 0xbf18
movq %rbx, %rdi
movl $0x1, %esi
movq %rax, %rdx
jmp 0xb781
leaq 0x33a2f(%rip), %rdi     # 0x3f040
movq %rbx, %rsi
callq 0x829e
jmp 0xb619
xorl %ebx, %ebx
jmp 0xb786
leaq 0x33a17(%rip), %rdi     # 0x3f040
movq %r15, %rsi
callq 0x829e
jmp 0xb631
movq %rbx, %rdi
movl $0xc8, %esi
callq 0x262b4
movq %rbx, %rdi
callq 0x26288
movq %rax, %rdi
xorl %esi, %esi
callq 0x604d
movq %rbx, %rdi
callq 0x26288
movq %rax, %rdi
movl $0x3, %esi
movl $0x3, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x22602
movq %rbx, %rdi
callq 0x4abc
movl %eax, %r14d
movq %rbx, %rdi
callq 0x4bc6
movl %eax, %ebp
cmpb $0x1, %r14b
jne 0xb69c
movq %rbx, %rdi
callq 0x5651
addl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x196f4
movq %rax, 0x50(%r15)
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x22602
movq %rbx, %rdi
movl $0x4, %esi
callq 0x25c83
leaq 0x549f3(%rip), %rdx     # 0x600c8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x25d1f
leaq 0x33bc3(%rip), %rsi     # 0x3f2ac
movq %rbx, %rdi
callq 0xbdc0
movq %rbx, %rdi
callq 0x4abc
cmpb $0x1, %al
jne 0xb707
movq %rbx, %rdi
callq 0x5651
subl %eax, %ebp
movswl %bp, %esi
movq %rbx, %rdi
callq 0x54c3
callq 0x2e244
testq %rax, %rax
je 0xb74d
movq %rax, %r14
movq 0x298(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xbe8d
movq 0x2a0(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0xbe8d
movq 0x2a8(%r14), %rdx
jmp 0xb779
leaq 0x54854(%rip), %rdx     # 0x5ffa8
movq %rbx, %rdi
xorl %esi, %esi
callq 0xbe8d
leaq 0x547fb(%rip), %rdx     # 0x5ff60
movq %rbx, %rdi
movl $0x1, %esi
callq 0xbe8d
leaq 0x54877(%rip), %rdx     # 0x5fff0
movq %rbx, %rdi
movl $0x2, %esi
callq 0xbe8d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq