// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_tabview.c
// Function: tabview_realign
static void tabview_realign(lv_obj_t * tabview)
{
    lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);

    lv_obj_set_width(ext->btns, lv_obj_get_width(tabview));

    if(ext->btns_hide) {
        lv_obj_set_hidden(ext->btns, true);
        lv_obj_set_hidden(ext->indic, true);
        lv_obj_set_height(ext->content, lv_obj_get_height(tabview));
        lv_obj_align(ext->content, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
    } else if(ext->tab_cnt != 0) {
        lv_obj_set_hidden(ext->btns, false);
        lv_obj_set_hidden(ext->indic, false);

        const lv_style_t * style_btn_bg  = lv_tabview_get_style(tabview, LV_TABVIEW_STYLE_BTN_BG);
        const lv_style_t * style_btn_rel = lv_tabview_get_style(tabview, LV_TABVIEW_STYLE_BTN_REL);

        /*Set the indicator width/height*/
        lv_coord_t indic_size;
        lv_coord_t max_h;

        switch(ext->btns_pos) {
            case LV_TABVIEW_BTNS_POS_TOP:
            case LV_TABVIEW_BTNS_POS_BOTTOM:
                indic_size = (lv_obj_get_width(tabview) - style_btn_bg->body.padding.inner * (ext->tab_cnt - 1) -
                              style_btn_bg->body.padding.left - style_btn_bg->body.padding.right) /
                             ext->tab_cnt;
                lv_obj_set_width(ext->indic, indic_size);
                break;
            case LV_TABVIEW_BTNS_POS_LEFT:
            case LV_TABVIEW_BTNS_POS_RIGHT:
                lv_obj_set_height(ext->btns, lv_obj_get_height(tabview));

                max_h =
                    lv_obj_get_height(ext->btns) - style_btn_bg->body.padding.top - style_btn_bg->body.padding.bottom;
                indic_size = max_h - ((ext->tab_cnt - 1) * style_btn_bg->body.padding.inner);
                indic_size = indic_size / ext->tab_cnt;
                indic_size--; /*-1 because e.g. height = 100 means 101 pixels (0..100)*/
                lv_obj_set_height(ext->indic, indic_size);
                break;
        }

        /*Set the tabs height/width*/
        lv_coord_t btns_size;

        switch(ext->btns_pos) {
            case LV_TABVIEW_BTNS_POS_TOP:
            case LV_TABVIEW_BTNS_POS_BOTTOM:
                btns_size = lv_font_get_line_height(style_btn_rel->text.font) + style_btn_rel->body.padding.top +
                            style_btn_rel->body.padding.bottom + style_btn_bg->body.padding.top +
                            style_btn_bg->body.padding.bottom;
                lv_obj_set_height(ext->btns, btns_size);
                break;
            case LV_TABVIEW_BTNS_POS_LEFT:
            case LV_TABVIEW_BTNS_POS_RIGHT:
                btns_size = lv_font_get_glyph_width(style_btn_rel->text.font, 'A', '\0') +
                            style_btn_rel->body.padding.left + style_btn_rel->body.padding.right +
                            style_btn_bg->body.padding.left + style_btn_bg->body.padding.right;
                lv_obj_set_width(ext->btns, btns_size);
                break;
        }

        switch(ext->btns_pos) {
            case LV_TABVIEW_BTNS_POS_TOP:
            case LV_TABVIEW_BTNS_POS_BOTTOM:
                lv_obj_set_height(ext->content, lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns));
                break;
            case LV_TABVIEW_BTNS_POS_LEFT:
            case LV_TABVIEW_BTNS_POS_RIGHT: lv_obj_set_height(ext->content, lv_obj_get_height(tabview)); break;
        }

        switch(ext->btns_pos) {
            case LV_TABVIEW_BTNS_POS_TOP:
                lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
                lv_obj_align(ext->content, ext->btns, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
                lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);

                lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
                lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
                lv_obj_set_height(ext->content, lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns));
                break;
            case LV_TABVIEW_BTNS_POS_BOTTOM:
                lv_obj_align(ext->content, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
                lv_obj_align(ext->btns, ext->content, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
                lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0);

                lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
                lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
                lv_obj_set_height(ext->content, lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns));
                break;
            case LV_TABVIEW_BTNS_POS_LEFT:
                lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
                lv_obj_align(ext->content, tabview, LV_ALIGN_IN_TOP_LEFT, lv_obj_get_width(ext->btns), 0);
                lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_RIGHT, 0, 0);

                lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
                lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
                lv_obj_set_width(ext->content, lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns));

                lv_obj_set_height(ext->btns, lv_obj_get_height(tabview));
                lv_obj_set_width(ext->indic, style_btn_bg->body.padding.inner);
                break;
            case LV_TABVIEW_BTNS_POS_RIGHT:
                lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
                lv_obj_align(ext->content, tabview, LV_ALIGN_IN_TOP_LEFT, 0, 0);
                lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0);

                lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
                lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
                lv_obj_set_width(ext->content, lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns));

                lv_obj_set_height(ext->btns, lv_obj_get_height(tabview));
                lv_obj_set_width(ext->indic, style_btn_bg->body.padding.inner);
                break;
        }
    }

    lv_obj_t * pages = lv_obj_get_child(ext->content, NULL);
    while(pages != NULL) {
        if(lv_obj_get_signal_cb(pages) == tabpage_signal) { /*Be sure adjust only the pages (user can other things)*/
            switch(ext->btns_pos) {
                case LV_TABVIEW_BTNS_POS_TOP:
                case LV_TABVIEW_BTNS_POS_BOTTOM:
                    lv_obj_set_size(pages, lv_obj_get_width(tabview), lv_obj_get_height(ext->content));
                    break;
                case LV_TABVIEW_BTNS_POS_LEFT:
                case LV_TABVIEW_BTNS_POS_RIGHT:
                    lv_obj_set_size(pages, lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns),
                                    lv_obj_get_height(ext->content));
                    break;
            }
        }
        pages = lv_obj_get_child(ext->content, pages);
    }

    if(!ext->btns_hide) {
        switch(ext->btns_pos) {
            case LV_TABVIEW_BTNS_POS_TOP: lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); break;
            case LV_TABVIEW_BTNS_POS_BOTTOM: lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0); break;
            case LV_TABVIEW_BTNS_POS_LEFT: lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_RIGHT, 0, 0); break;
            case LV_TABVIEW_BTNS_POS_RIGHT: lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0); break;
        }
    }

    lv_tabview_set_tab_act(tabview, ext->tab_cur, LV_ANIM_OFF);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x6ad8
movq %rax, %r14
movq (%rax), %r15
movq %rbx, %rdi
callq 0x5651
movswl %ax, %esi
movq %r15, %rdi
callq 0x56f1
testb $0x10, 0x2a(%r14)
jne 0x11893
cmpw $0x0, 0x26(%r14)
je 0x11b92
movq (%r14), %rdi
xorl %esi, %esi
callq 0x5f68
movq 0x8(%r14), %rdi
xorl %esi, %esi
callq 0x5f68
movq %rbx, %rdi
movl $0x2, %esi
callq 0x11f43
movq %rax, %r15
movq %rbx, %rdi
movl $0x3, %esi
callq 0x11f43
movq %rax, %r12
testb $0x40, 0x2a(%r14)
jne 0x118df
movq %rbx, %rdi
callq 0x5651
cwtl
movswl 0x1e(%r15), %ecx
movzwl 0x26(%r14), %esi
movl $0x1, %edx
subl %esi, %edx
imull %ecx, %edx
movswl 0x1a(%r15), %ecx
movswl 0x1c(%r15), %edi
addl %ecx, %edi
subl %edi, %eax
addl %edx, %eax
cltd
idivl %esi
movq 0x8(%r14), %rdi
movswl %ax, %esi
callq 0x56f1
jmp 0x1192f
movq (%r14), %rdi
movl $0x1, %esi
callq 0x5f68
movq 0x8(%r14), %rdi
movl $0x1, %esi
callq 0x5f68
movq 0x10(%r14), %r15
movq %rbx, %rdi
callq 0x567b
movswl %ax, %esi
movq %r15, %rdi
callq 0x572f
movq 0x10(%r14), %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
jmp 0x11b92
movq (%r14), %r13
movq %rbx, %rdi
callq 0x567b
movswl %ax, %esi
movq %r13, %rdi
callq 0x572f
movq (%r14), %rdi
callq 0x567b
movzwl 0x16(%r15), %ecx
movzwl 0x26(%r14), %esi
movl $0x1, %edx
subl %esi, %edx
imulw 0x1e(%r15), %dx
addw 0x18(%r15), %cx
subl %ecx, %eax
addl %edx, %eax
cwtl
cltd
idivl %esi
decl %eax
movq 0x8(%r14), %rdi
movswl %ax, %esi
callq 0x572f
testb $0x40, 0x2a(%r14)
movq 0x28(%r12), %rdi
jne 0x11962
movzbl 0x10(%rdi), %eax
addw 0x16(%r12), %ax
addw 0x18(%r12), %ax
addw 0x16(%r15), %ax
addw 0x18(%r15), %ax
movq (%r14), %rdi
movswl %ax, %esi
callq 0x572f
jmp 0x1198f
movl $0x41, %esi
xorl %edx, %edx
callq 0x27d87
addw 0x1a(%r12), %ax
addw 0x1c(%r12), %ax
addw 0x1a(%r15), %ax
addw 0x1c(%r15), %ax
movq (%r14), %rdi
movswl %ax, %esi
callq 0x56f1
movb 0x2a(%r14), %r13b
movq 0x10(%r14), %r12
movq %rbx, %rdi
callq 0x567b
movl %eax, %ebp
testb $0x40, %r13b
jne 0x119b1
movq (%r14), %rdi
callq 0x567b
subl %eax, %ebp
movswl %bp, %esi
movq %r12, %rdi
callq 0x572f
movzbl 0x2a(%r14), %eax
shrl $0x5, %eax
andl $0x3, %eax
leaq 0x2dba6(%rip), %rcx     # 0x3f574
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r14), %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq (%r14), %rsi
movq 0x10(%r14), %rdi
movl $0xc, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movl $0x4, %edx
jmp 0x11b3f
movq (%r14), %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq (%r14), %rdi
movq 0x10(%r14), %r12
callq 0x5651
movswl %ax, %ecx
movq %r12, %rdi
movq %rbx, %rsi
movl $0x1, %edx
xorl %r8d, %r8d
callq 0x576d
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movl $0x3, %edx
jmp 0x11a8c
movq (%r14), %rdi
xorl %esi, %esi
movl $0x3, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq 0x10(%r14), %rdi
movq %rbx, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq 0x10(%r14), %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x22602
movq 0x10(%r14), %rdi
movl $0x5, %esi
callq 0x2259a
movq 0x10(%r14), %r12
movq %rbx, %rdi
callq 0x5651
movl %eax, %ebp
movq (%r14), %rdi
callq 0x5651
subl %eax, %ebp
movswl %bp, %esi
movq %r12, %rdi
callq 0x56f1
movq (%r14), %r12
movq %rbx, %rdi
callq 0x567b
movswl %ax, %esi
movq %r12, %rdi
callq 0x572f
movq 0x8(%r14), %rdi
movswl 0x1e(%r15), %esi
callq 0x56f1
jmp 0x11b92
movq 0x10(%r14), %rdi
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq (%r14), %rdi
movq 0x10(%r14), %rsi
movl $0xc, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movq 0x10(%r14), %rdi
movl $0x1, %esi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x22602
movq 0x10(%r14), %rdi
movl $0x5, %esi
callq 0x2259a
movq 0x10(%r14), %r15
movq %rbx, %rdi
callq 0x567b
movl %eax, %ebp
movq (%r14), %rdi
callq 0x567b
subl %eax, %ebp
movswl %bp, %esi
movq %r15, %rdi
callq 0x572f
movq 0x10(%r14), %rdi
xorl %esi, %esi
callq 0x51a3
testq %rax, %rax
je 0x11c02
movq %rax, %r15
leaq -0x560(%rip), %r12      # 0x1164c
movq %r15, %rdi
callq 0x6a6c
cmpq %r12, %rax
jne 0x11bee
movb 0x2a(%r14), %r13b
movq %rbx, %rdi
callq 0x5651
movl %eax, %ebp
testb $0x40, %r13b
je 0x11bd7
movq (%r14), %rdi
callq 0x5651
subl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0x567b
movswl %bp, %esi
movswl %ax, %edx
movq %r15, %rdi
callq 0x553f
movq 0x10(%r14), %rdi
movq %r15, %rsi
callq 0x51a3
movq %rax, %r15
testq %rax, %rax
jne 0x11bac
movzbl 0x2a(%r14), %ecx
testb $0x10, %cl
jne 0x11c2d
shrb $0x2, %cl
andb $0x18, %cl
movl $0x1030104, %eax        # imm = 0x1030104
shrl %cl, %eax
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movzbl %al, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x576d
movzwl 0x24(%r14), %esi
movq %rbx, %rdi
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11c4a