// File: /workspace/github_c_makefile_star2_O2/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 0x6747
movq %rax, %r14
movq (%rax), %r15
movq %rbx, %rdi
callq 0x5308
movswl %ax, %esi
movq %r15, %rdi
callq 0x53a8
testb $0x10, 0x2a(%r14)
jne 0x10ba2
cmpw $0x0, 0x26(%r14)
je 0x10e5d
movq (%r14), %rdi
xorl %esi, %esi
callq 0x5bfe
movq 0x8(%r14), %rdi
xorl %esi, %esi
callq 0x5bfe
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x111f0
movq %rax, %r15
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x111f0
movq %rax, %r12
testb $0x40, 0x2a(%r14)
jne 0x10be8
movq %rbx, %rdi
callq 0x5308
cwtl
movswl 0x1e(%r15), %ecx
movzwl 0x26(%r14), %esi
pushq $0x1
popq %rdx
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 0x53a8
jmp 0x10c36
movq (%r14), %rdi
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0x5bfe
movq 0x8(%r14), %rdi
movl %ebp, %esi
callq 0x5bfe
movq 0x10(%r14), %r15
movq %rbx, %rdi
callq 0x5332
movswl %ax, %esi
movq %r15, %rdi
callq 0x53e6
movq 0x10(%r14), %rdi
xorl %esi, %esi
movl %ebp, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
jmp 0x10e5d
movq (%r14), %r13
movq %rbx, %rdi
callq 0x5332
movswl %ax, %esi
movq %r13, %rdi
callq 0x53e6
movq (%r14), %rdi
callq 0x5332
movzwl 0x16(%r15), %ecx
movzwl 0x26(%r14), %esi
pushq $0x1
popq %rdx
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 0x53e6
testb $0x40, 0x2a(%r14)
movq 0x28(%r12), %rdi
jne 0x10c69
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 0x53e6
jmp 0x10c94
pushq $0x41
popq %rsi
xorl %edx, %edx
callq 0x2603b
addw 0x1a(%r12), %ax
addw 0x1c(%r12), %ax
addw 0x1a(%r15), %ax
addw 0x1c(%r15), %ax
movq (%r14), %rdi
movswl %ax, %esi
callq 0x53a8
movb 0x2a(%r14), %r13b
movq 0x10(%r14), %r12
movq %rbx, %rdi
callq 0x5332
movl %eax, %ebp
testb $0x40, %r13b
jne 0x10cb6
movq (%r14), %rdi
callq 0x5332
subl %eax, %ebp
movswl %bp, %esi
movq %r12, %rdi
callq 0x53e6
movzbl 0x2a(%r14), %eax
shrl $0x5, %eax
andl $0x3, %eax
leaq 0x2a8dd(%rip), %rcx     # 0x3b5b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r14), %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq (%r14), %rsi
movq 0x10(%r14), %rdi
pushq $0xc
popq %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq (%r14), %rsi
movq 0x8(%r14), %rdi
pushq $0x4
popq %rdx
jmp 0x10e1b
movq (%r14), %rdi
pushq $0x1
popq %rbp
xorl %esi, %esi
movl %ebp, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq (%r14), %rdi
movq 0x10(%r14), %r12
callq 0x5308
movswl %ax, %ecx
movq %r12, %rdi
movq %rbx, %rsi
movl %ebp, %edx
xorl %r8d, %r8d
callq 0x5424
movq (%r14), %rsi
movq 0x8(%r14), %rdi
pushq $0x3
popq %rdx
jmp 0x10d81
movq (%r14), %rdi
pushq $0x3
popq %rdx
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq 0x10(%r14), %rdi
pushq $0x1
popq %rbp
movq %rbx, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movl %ebp, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq 0x10(%r14), %rdi
callq 0x104bf
movq 0x10(%r14), %rdi
pushq $0x5
popq %rsi
callq 0x20bca
movq 0x10(%r14), %r12
movq %rbx, %rdi
callq 0x5308
movl %eax, %ebp
movq (%r14), %rdi
callq 0x5308
subl %eax, %ebp
movswl %bp, %esi
movq %r12, %rdi
callq 0x53a8
movq (%r14), %r12
movq %rbx, %rdi
callq 0x5332
movswl %ax, %esi
movq %r12, %rdi
callq 0x53e6
movq 0x8(%r14), %rdi
movswl 0x1e(%r15), %esi
callq 0x53a8
jmp 0x10e5d
movq 0x10(%r14), %rdi
pushq $0x1
popq %rbp
xorl %esi, %esi
movl %ebp, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq (%r14), %rdi
movq 0x10(%r14), %rsi
pushq $0xc
popq %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq (%r14), %rsi
movq 0x8(%r14), %rdi
movl %ebp, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5424
movq 0x10(%r14), %rdi
callq 0x104bf
movq 0x10(%r14), %rdi
pushq $0x5
popq %rsi
callq 0x20bca
movq 0x10(%r14), %r15
movq %rbx, %rdi
callq 0x5332
movl %eax, %ebp
movq (%r14), %rdi
callq 0x5332
subl %eax, %ebp
movswl %bp, %esi
movq %r15, %rdi
callq 0x53e6
movq 0x10(%r14), %rdi
xorl %esi, %esi
callq 0x4e4d
movq %rax, %r15
leaq -0x4e1(%rip), %r12      # 0x10991
testq %r15, %r15
je 0x10eca
movq %r15, %rdi
callq 0x66db
cmpq %r12, %rax
jne 0x10eb9
movb 0x2a(%r14), %r13b
movq %rbx, %rdi
callq 0x5308
movl %eax, %ebp
testb $0x40, %r13b
je 0x10ea2
movq (%r14), %rdi
callq 0x5308
subl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0x5332
movswl %bp, %esi
movswl %ax, %edx
movq %r15, %rdi
callq 0x520e
movq 0x10(%r14), %rdi
movq %r15, %rsi
callq 0x4e4d
movq %rax, %r15
jmp 0x10e72
movzbl 0x2a(%r14), %ecx
testb $0x10, %cl
jne 0x10ef5
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 0x5424
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 0x10f12