// File: /workspace/github_c_makefile_star2_O3/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 0x25398
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0xb574
testq %rbx, %rbx
je 0xb585
cmpq $0x0, 0x54f09(%rip)     # 0x602d0
jne 0xb3d8
movq %rbx, %rdi
callq 0x6a8b
movq %rax, 0x54ef8(%rip)     # 0x602d0
cmpq $0x0, 0x54ef8(%rip)     # 0x602d8
jne 0xb3f9
movq %rbx, %rdi
callq 0x2695e
movq %rax, %rdi
callq 0x6a8b
movq %rax, 0x54edf(%rip)     # 0x602d8
cmpq $0x0, 0x54edf(%rip)     # 0x602e0
jne 0xb412
movq %rbx, %rdi
callq 0x6aaf
movq %rax, 0x54ece(%rip)     # 0x602e0
movq %rbx, %rdi
movl $0x70, %esi
callq 0x64db
movq %rax, %r15
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0xb58c
testq %r15, %r15
je 0xb585
movq $0x0, 0x50(%r15)
xorl %eax, %eax
movw %ax, 0x68(%r15)
movw %ax, 0x64(%r15)
movl $0x0, 0x60(%r15)
leaq 0x54b02(%rip), %rax     # 0x5ff60
movq %rax, 0x58(%r15)
andb $-0xe, 0x66(%r15)
leaq 0x294(%rip), %rsi       # 0xb702
movq %rbx, %rdi
callq 0x647b
movq %rbx, %rdi
callq 0x2695e
leaq 0x458(%rip), %rsi       # 0xb8dd
movq %rax, %rdi
callq 0x647b
leaq 0x4dd(%rip), %rsi       # 0xb971
movq %rbx, %rdi
callq 0x64ab
testq %r14, %r14
je 0xb59d
movq %r14, %rdi
callq 0x6af7
movq %rax, %r12
movq 0x50(%rax), %rsi
movq %rbx, %rdi
callq 0x19ed4
movq %rax, %r13
movq %rax, 0x50(%r15)
movq 0x50(%r12), %rdi
callq 0x1aa00
movq %r13, %rdi
movq %rax, %rsi
callq 0x1a6da
movzwl 0x68(%r12), %eax
movw %ax, 0x68(%r15)
movl 0x60(%r12), %eax
movl %eax, %ecx
shrl $0x10, %ecx
movw %cx, 0x64(%r15)
movl %eax, 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 0xbe51
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xbdc6
movq %r14, %rdi
movl $0x2, %esi
callq 0xbe51
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0xbdc6
movq %r14, %rdi
movl $0x1, %esi
callq 0xbe51
movq %rbx, %rdi
movl $0x1, %esi
movq %rax, %rdx
jmp 0xb6eb
leaq 0x33b55(%rip), %rdi     # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0xb583
xorl %ebx, %ebx
jmp 0xb6f0
leaq 0x33b3d(%rip), %rdi     # 0x3f0d0
movq %r15, %rsi
callq 0x8294
jmp 0xb59b
movq %rbx, %rdi
movl $0xc8, %esi
callq 0x2698a
movq %rbx, %rdi
callq 0x2695e
movq %rax, %rdi
xorl %esi, %esi
callq 0x606c
movq %rbx, %rdi
callq 0x2695e
movq %rax, %rdi
movl $0x3, %esi
movl $0x3, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x22d84
movq %rbx, %rdi
callq 0x4ab2
movl %eax, %r14d
movq %rbx, %rdi
callq 0x4bdd
movl %eax, %ebp
cmpb $0x1, %r14b
jne 0xb606
movq %rbx, %rdi
callq 0x566d
addl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x19ed4
movq %rax, 0x50(%r15)
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x22d84
movq %rbx, %rdi
movl $0x4, %esi
callq 0x2636f
leaq 0x54a89(%rip), %rdx     # 0x600c8
movq %rbx, %rdi
movl $0x1, %esi
callq 0x2640b
leaq 0x33d09(%rip), %rsi     # 0x3f35c
movq %rbx, %rdi
callq 0xbcf3
movq %rbx, %rdi
callq 0x4ab2
cmpb $0x1, %al
jne 0xb671
movq %rbx, %rdi
callq 0x566d
subl %eax, %ebp
movswl %bp, %esi
movq %rbx, %rdi
callq 0x54db
callq 0x2e91c
testq %rax, %rax
je 0xb6b7
movq %rax, %r14
movq 0x298(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xbdc6
movq 0x2a0(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0xbdc6
movq 0x2a8(%r14), %rdx
jmp 0xb6e3
leaq 0x548ea(%rip), %rdx     # 0x5ffa8
movq %rbx, %rdi
xorl %esi, %esi
callq 0xbdc6
leaq 0x54891(%rip), %rdx     # 0x5ff60
movq %rbx, %rdi
movl $0x1, %esi
callq 0xbdc6
leaq 0x5490d(%rip), %rdx     # 0x5fff0
movq %rbx, %rdi
movl $0x2, %esi
callq 0xbdc6
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq