// File: /workspace/github_c_makefile_star2_O2/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 0x230ac
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0xac1a
testq %rbx, %rbx
je 0xac2b
cmpq $0x0, 0x53855(%rip)     # 0x5e2d0
jne 0xaa8c
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x53844(%rip)     # 0x5e2d0
cmpq $0x0, 0x53844(%rip)     # 0x5e2d8
jne 0xaaad
movq %rbx, %rdi
callq 0x245d9
movq %rax, %rdi
callq 0x66db
movq %rax, 0x5382b(%rip)     # 0x5e2d8
cmpq $0x0, 0x5382b(%rip)     # 0x5e2e0
jne 0xaac6
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x5381a(%rip)     # 0x5e2e0
pushq $0x70
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r15
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0xac32
testq %r15, %r15
je 0xac2b
andq $0x0, 0x50(%r15)
andw $0x0, 0x68(%r15)
andw $0x0, 0x64(%r15)
andl $0x0, 0x60(%r15)
leaq 0x53456(%rip), %rax     # 0x5df60
movq %rax, 0x58(%r15)
andb $-0xe, 0x66(%r15)
leaq 0x267(%rip), %rsi       # 0xad81
movq %rbx, %rdi
callq 0x60e6
movq %rbx, %rdi
callq 0x245d9
leaq 0x422(%rip), %rsi       # 0xaf53
movq %rax, %rdi
callq 0x60e6
leaq 0x4a4(%rip), %rsi       # 0xafe4
movq %rbx, %rdi
callq 0x6116
testq %r14, %r14
je 0xac43
movq %r14, %rdi
callq 0x6747
movq %rax, %r12
movq 0x50(%rax), %rsi
movq %rbx, %rdi
callq 0x182f0
movq %rax, %r13
movq %rax, 0x50(%r15)
movq 0x50(%r12), %rdi
callq 0x18db9
movq %r13, %rdi
movq %rax, %rsi
callq 0x18a9a
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 0xb4ce
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
callq 0xb445
pushq $0x2
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0xb4ce
movq %rbx, %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0xb445
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0xb4ce
movq %rbx, %rdi
movl %ebp, %esi
movq %rax, %rdx
jmp 0xad6a
leaq 0x3041f(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0xac29
xorl %ebx, %ebx
jmp 0xad6f
leaq 0x30407(%rip), %rdi     # 0x3b040
movq %r15, %rsi
callq 0x7b01
jmp 0xac41
movq %rbx, %rdi
movl $0xc8, %esi
callq 0x24605
movq %rbx, %rdi
callq 0x245d9
movq %rax, %rdi
xorl %esi, %esi
callq 0x5ce4
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0xb34f
movq %rbx, %rdi
callq 0x47b9
movl %eax, %r14d
movq %rbx, %rdi
callq 0x48ca
movl %eax, %ebp
cmpb $0x1, %r14b
jne 0xac95
movq %rbx, %rdi
callq 0x5308
addl %eax, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x182f0
movq %rax, 0x50(%r15)
pushq $0x1
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0xb36a
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x23fed
leaq 0x53402(%rip), %rdx     # 0x5e0c8
movq %rbx, %rdi
movl %r14d, %esi
callq 0x24089
leaq 0x305e4(%rip), %rsi     # 0x3b2bc
movq %rbx, %rdi
callq 0xb376
movq %rbx, %rdi
callq 0x47b9
cmpb $0x1, %al
jne 0xacf6
movq %rbx, %rdi
callq 0x5308
subl %eax, %ebp
movswl %bp, %esi
movq %rbx, %rdi
callq 0x5192
callq 0x2be75
testq %rax, %rax
je 0xad3a
movq %rax, %r14
movq 0x298(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xb445
movq 0x2a0(%r14), %rdx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xb445
movq 0x2a8(%r14), %rdx
jmp 0xad64
leaq 0x53267(%rip), %rdx     # 0x5dfa8
movq %rbx, %rdi
xorl %esi, %esi
callq 0xb445
leaq 0x5320e(%rip), %rdx     # 0x5df60
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xb445
leaq 0x5328c(%rip), %rdx     # 0x5dff0
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0xb445
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq