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

    /*Create the ancestor of tab*/
    lv_obj_t * new_tabview = lv_obj_create(par, copy);
    LV_ASSERT_MEM(new_tabview);
    if(new_tabview == NULL) return NULL;
    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_tabview);

    /*Allocate the tab type specific extended data*/
    lv_tabview_ext_t * ext = lv_obj_allocate_ext_attr(new_tabview, sizeof(lv_tabview_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    /*Initialize the allocated 'ext' */
    ext->drag_hor     = 0;
    ext->draging      = 0;
    ext->scroll_ver   = 0;
    ext->slide_enable = 1;
    ext->tab_cur      = 0;
    ext->point_last.x = 0;
    ext->point_last.y = 0;
    ext->content      = NULL;
    ext->indic        = NULL;
    ext->btns         = NULL;
    ext->btns_pos     = LV_TABVIEW_BTNS_POS_TOP;
#if LV_USE_ANIMATION
    ext->anim_time = LV_TABVIEW_DEF_ANIM_TIME;
#endif
    ext->btns_hide = 0;

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

    /*Init the new tab tab*/
    if(copy == NULL) {
        ext->tab_name_ptr = lv_mem_alloc(sizeof(char *));
        LV_ASSERT_MEM(ext->tab_name_ptr);
        if(ext->tab_name_ptr == NULL) return NULL;
        ext->tab_name_ptr[0] = "";
        ext->tab_cnt         = 0;

        /* Set a size which fits into the parent.
         * Don't use `par` directly because if the tabview is created on a page it is moved to the
         * scrollable so the parent has changed */
        lv_obj_set_size(new_tabview, lv_obj_get_width_fit(lv_obj_get_parent(new_tabview)),
                        lv_obj_get_height_fit(lv_obj_get_parent(new_tabview)));

        ext->content = lv_cont_create(new_tabview, NULL);
        ext->btns    = lv_btnm_create(new_tabview, NULL);
        ext->indic   = lv_obj_create(ext->btns, NULL);

        lv_obj_set_height(ext->btns, 3 * LV_DPI / 4);
        lv_btnm_set_map(ext->btns, tab_def);
        lv_obj_set_event_cb(ext->btns, tab_btnm_event_cb);

        lv_obj_set_width(ext->indic, LV_DPI);
        lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
        lv_obj_set_click(ext->indic, false);

        lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
        lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
        lv_cont_set_style(ext->content, LV_CONT_STYLE_MAIN, &lv_style_transp_tight);
        lv_obj_set_height(ext->content, lv_obj_get_height(new_tabview) - lv_obj_get_height(ext->btns));
        lv_obj_align(ext->content, ext->btns, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_BG, th->style.tabview.bg);
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_INDIC, th->style.tabview.indic);
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_BTN_BG, th->style.tabview.btn.bg);
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_BTN_REL, th->style.tabview.btn.rel);
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_BTN_PR, th->style.tabview.btn.pr);
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_BTN_TGL_REL, th->style.tabview.btn.tgl_rel);
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_BTN_TGL_PR, th->style.tabview.btn.tgl_pr);
        } else {
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_BG, &lv_style_plain);
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_BTN_BG, &lv_style_pretty);//transp);
            lv_tabview_set_style(new_tabview, LV_TABVIEW_STYLE_INDIC, &lv_style_plain_color);
        }
    }
    /*Copy an existing tab view*/
    else {
        lv_tabview_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->point_last.x           = 0;
        ext->point_last.y           = 0;
        ext->btns                   = lv_btnm_create(new_tabview, copy_ext->btns);
        ext->indic                  = lv_obj_create(ext->btns, copy_ext->indic);
        ext->content                = lv_cont_create(new_tabview, copy_ext->content);
#if LV_USE_ANIMATION
        ext->anim_time = copy_ext->anim_time;
#endif

        ext->tab_name_ptr = lv_mem_alloc(sizeof(char *));
        LV_ASSERT_MEM(ext->tab_name_ptr);
        if(ext->tab_name_ptr == NULL) return NULL;
        ext->tab_name_ptr[0] = "";
        lv_btnm_set_map(ext->btns, ext->tab_name_ptr);

        uint16_t i;
        lv_obj_t * new_tab;
        lv_obj_t * copy_tab;
        for(i = 0; i < copy_ext->tab_cnt; i++) {
            new_tab  = lv_tabview_add_tab(new_tabview, copy_ext->tab_name_ptr[i]);
            copy_tab = lv_tabview_get_tab(copy, i);
            lv_page_set_style(new_tab, LV_PAGE_STYLE_BG, lv_page_get_style(copy_tab, LV_PAGE_STYLE_BG));
            lv_page_set_style(new_tab, LV_PAGE_STYLE_SCRL, lv_page_get_style(copy_tab, LV_PAGE_STYLE_SCRL));
            lv_page_set_style(new_tab, LV_PAGE_STYLE_SB, lv_page_get_style(copy_tab, LV_PAGE_STYLE_SB));
        }

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

    LV_LOG_INFO("tab view created");

    return new_tabview;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x66b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x1bc83
movq -0x20(%rbp), %rsi
leaq 0x4c3c8(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x1bc81
cmpq $0x0, -0x20(%rbp)
jne 0x1bc97
movq $0x0, -0x8(%rbp)
jmp 0x1c2a7
cmpq $0x0, 0x6d761(%rip)     # 0x89400
jne 0x1bcb1
movq -0x20(%rbp), %rdi
callq 0xa830
movq %rax, 0x6d74f(%rip)     # 0x89400
movq -0x20(%rbp), %rdi
movl $0x30, %esi
callq 0x9d60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x1bce2
movq -0x28(%rbp), %rsi
leaq 0x4c369(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x1bce0
cmpq $0x0, -0x28(%rbp)
jne 0x1bcf6
movq $0x0, -0x8(%rbp)
jmp 0x1c2a7
movq -0x28(%rbp), %rax
movb 0x2a(%rax), %cl
andb $-0x5, %cl
orb $0x0, %cl
movb %cl, 0x2a(%rax)
movq -0x28(%rbp), %rax
movb 0x2a(%rax), %cl
andb $-0x3, %cl
orb $0x0, %cl
movb %cl, 0x2a(%rax)
movq -0x28(%rbp), %rax
movb 0x2a(%rax), %cl
andb $-0x9, %cl
orb $0x0, %cl
movb %cl, 0x2a(%rax)
movq -0x28(%rbp), %rax
movb 0x2a(%rax), %cl
andb $-0x2, %cl
orb $0x1, %cl
movb %cl, 0x2a(%rax)
movq -0x28(%rbp), %rax
movw $0x0, 0x24(%rax)
movq -0x28(%rbp), %rax
movw $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
movw $0x0, 0x22(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rax
movb 0x2a(%rax), %cl
andb $-0x61, %cl
orb $0x0, %cl
movb %cl, 0x2a(%rax)
movq -0x28(%rbp), %rax
movw $0x12c, 0x28(%rax)      # imm = 0x12C
movq -0x28(%rbp), %rax
movb 0x2a(%rax), %cl
andb $-0x11, %cl
orb $0x0, %cl
movb %cl, 0x2a(%rax)
movq -0x20(%rbp), %rdi
leaq 0x514(%rip), %rsi       # 0x1c2c0
callq 0x9cc0
cmpq $0x0, -0x18(%rbp)
jne 0x1c0c8
movl $0x8, %edi
callq 0x44d20
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xd120
testb $0x1, %al
jne 0x1bdf8
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x4c253(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x1bdf6
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1be10
movq $0x0, -0x8(%rbp)
jmp 0x1c2a7
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
leaq 0x502f6(%rip), %rcx     # 0x6c115
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movw $0x0, 0x26(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rdi
callq 0x71b0
movq %rax, %rdi
callq 0xa1e0
movw %ax, -0x62(%rbp)
movq -0x20(%rbp), %rdi
callq 0x71b0
movq %rax, %rdi
callq 0xa240
movq -0x70(%rbp), %rdi
movw -0x62(%rbp), %cx
movswl %cx, %esi
movswl %ax, %edx
callq 0x8180
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x381b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x35980
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x66b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movl $0x4b, %esi
callq 0x84a0
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq 0x6069a(%rip), %rsi     # 0x7c570
callq 0x36c80
movq -0x28(%rbp), %rax
movq (%rax), %rdi
leaq 0x697(%rip), %rsi       # 0x1c580
callq 0x9b00
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x64, %esi
callq 0x8430
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movl $0x4, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x8500
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
xorl %esi, %esi
callq 0x94b0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1c650
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x5, %esi
callq 0x385a0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %esi, %esi
leaq 0x6d233(%rip), %rdx     # 0x89198
callq 0x1c690
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
callq 0x8350
cwtl
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0x8350
movq -0x60(%rbp), %rdi
movw %ax, %cx
movl -0x54(%rbp), %eax
movswl %cx, %ecx
subl %ecx, %eax
movswl %ax, %esi
callq 0x84a0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movl $0xc, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x8500
callq 0x4cfc0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1c087
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x2c0(%rax), %rdx
xorl %esi, %esi
callq 0x1c6c0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x2c8(%rax), %rdx
movl $0x1, %esi
callq 0x1c6c0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x2d0(%rax), %rdx
movl $0x2, %esi
callq 0x1c6c0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x2d8(%rax), %rdx
movl $0x3, %esi
callq 0x1c6c0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x2e0(%rax), %rdx
movl $0x4, %esi
callq 0x1c6c0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x2e8(%rax), %rdx
movl $0x5, %esi
callq 0x1c6c0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x2f0(%rax), %rdx
movl $0x6, %esi
callq 0x1c6c0
jmp 0x1c0c3
movq -0x20(%rbp), %rdi
xorl %esi, %esi
leaq 0x6cf54(%rip), %rdx     # 0x88fe8
callq 0x1c6c0
movq -0x20(%rbp), %rdi
movl $0x2, %esi
leaq 0x6cfcf(%rip), %rdx     # 0x89078
callq 0x1c6c0
movq -0x20(%rbp), %rdi
movl $0x1, %esi
leaq 0x6cf72(%rip), %rdx     # 0x89030
callq 0x1c6c0
jmp 0x1c29f
movq -0x18(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movw $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
movw $0x0, 0x22(%rax)
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
callq 0x35980
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x66b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x381b0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
movw 0x28(%rax), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x28(%rax)
movl $0x8, %edi
callq 0x44d20
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xd120
testb $0x1, %al
jne 0x1c18a
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x4bec1(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x1c188
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x1c1a2
movq $0x0, -0x8(%rbp)
jmp 0x1c2a7
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
leaq 0x4ff64(%rip), %rcx     # 0x6c115
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x36c80
movw $0x0, -0x3a(%rbp)
movzwl -0x3a(%rbp), %eax
movq -0x38(%rbp), %rcx
movzwl 0x26(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1c296
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movzwl -0x3a(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x1c840
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
movzwl -0x3a(%rbp), %esi
callq 0x1cdb0
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x3e100
movq -0x88(%rbp), %rdi
movq %rax, %rdx
xorl %esi, %esi
callq 0x3dff0
movq -0x48(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0x3e100
movq -0x80(%rbp), %rdi
movq %rax, %rdx
movl $0x1, %esi
callq 0x3dff0
movq -0x48(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rdi
movl $0x2, %esi
callq 0x3e100
movq -0x78(%rbp), %rdi
movq %rax, %rdx
movl $0x2, %esi
callq 0x3dff0
movw -0x3a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x3a(%rbp)
jmp 0x1c1ce
movq -0x20(%rbp), %rdi
callq 0x9250
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)