// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_table.c
// Function: lv_table_design
static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_mode_t mode)
{
    /*Return false if the object is not covers the mask_p area*/
    if(mode == LV_DESIGN_COVER_CHK) {
        return false;
    }
    /*Draw the object*/
    else if(mode == LV_DESIGN_DRAW_MAIN) {
        ancestor_scrl_design(table, mask, mode);

        lv_table_ext_t * ext        = lv_obj_get_ext_attr(table);
        const lv_style_t * bg_style = lv_obj_get_style(table);
        lv_coord_t h_row;
        lv_point_t txt_size;
        lv_area_t cell_area;
        lv_area_t txt_area;
        lv_txt_flag_t txt_flags;
        lv_opa_t opa_scale = lv_obj_get_opa_scale(table);

        uint16_t col;
        uint16_t row;
        uint16_t cell = 0;

        cell_area.y2 = table->coords.y1 + bg_style->body.padding.top;
        for(row = 0; row < ext->row_cnt; row++) {
            h_row = get_row_height(table, row);

            cell_area.y1 = cell_area.y2 + 1;
            cell_area.y2 = cell_area.y1 + h_row - 1;

            cell_area.x2 = table->coords.x1 + bg_style->body.padding.left;

            for(col = 0; col < ext->col_cnt; col++) {

                lv_table_cell_format_t format;
                if(ext->cell_data[cell]) {
                    format.format_byte = ext->cell_data[cell][0];
                } else {
                    format.s.right_merge = 0;
                    format.s.align       = LV_LABEL_ALIGN_LEFT;
                    format.s.type        = 0;
                    format.s.crop        = 1;
                }


                lv_style_t cell_style;
                lv_style_copy(&cell_style, ext->cell_style[format.s.type]);
                cell_area.x1 = cell_area.x2 + 1;
                cell_area.x2 = cell_area.x1 + ext->col_w[col] - 1;

                uint16_t col_merge = 0;
                for(col_merge = 0; col_merge + col < ext->col_cnt - 1; col_merge++) {

                    if(ext->cell_data[cell + col_merge] != NULL) {
                        format.format_byte = ext->cell_data[cell + col_merge][0];
                        if(format.s.right_merge)
                            cell_area.x2 += ext->col_w[col + col_merge + 1];
                        else
                            break;
                    } else {
                        break;
                    }
                }

                lv_draw_rect(&cell_area, mask, &cell_style, opa_scale);

                if(ext->cell_data[cell]) {

                    txt_area.x1 = cell_area.x1 + cell_style.body.padding.left;
                    txt_area.x2 = cell_area.x2 - cell_style.body.padding.right;
                    txt_area.y1 = cell_area.y1 + cell_style.body.padding.top;
                    txt_area.y2 = cell_area.y2 - cell_style.body.padding.bottom;
                    /*Align the content to the middle if not cropped*/
                    if(format.s.crop == 0) {
                        txt_flags = LV_TXT_FLAG_NONE;
                    } else {
                        txt_flags = LV_TXT_FLAG_EXPAND;
                    }

                    lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style.text.font,
                                    cell_style.text.letter_space, cell_style.text.line_space,
                                    lv_area_get_width(&txt_area), txt_flags);

                    /*Align the content to the middle if not cropped*/
                    if(format.s.crop == 0) {
                        txt_area.y1 = cell_area.y1 + h_row / 2 - txt_size.y / 2;
                        txt_area.y2 = cell_area.y1 + h_row / 2 + txt_size.y / 2;
                    }

                    switch(format.s.align) {
                        default:
                        case LV_LABEL_ALIGN_LEFT: txt_flags |= LV_TXT_FLAG_NONE; break;
                        case LV_LABEL_ALIGN_RIGHT: txt_flags |= LV_TXT_FLAG_RIGHT; break;
                        case LV_LABEL_ALIGN_CENTER: txt_flags |= LV_TXT_FLAG_CENTER; break;
                    }

                    lv_area_t label_mask;
                    bool label_mask_ok;
                    label_mask_ok = lv_area_intersect(&label_mask, mask, &cell_area);
                    if(label_mask_ok) {
                        lv_draw_label(&txt_area, &label_mask, &cell_style, opa_scale, ext->cell_data[cell] + 1,
                                      txt_flags, NULL, NULL, NULL, lv_obj_get_base_dir(table));
                    }
                    /*Draw lines after '\n's*/
                    lv_point_t p1;
                    lv_point_t p2;
                    p1.x = cell_area.x1;
                    p2.x = cell_area.x2;
                    uint16_t i;
                    for(i = 1; ext->cell_data[cell][i] != '\0'; i++) {
                        if(ext->cell_data[cell][i] == '\n') {
                            ext->cell_data[cell][i] = '\0';
                            lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style.text.font,
                                            cell_style.text.letter_space, cell_style.text.line_space,
                                            lv_area_get_width(&txt_area), txt_flags);

                            p1.y = txt_area.y1 + txt_size.y + cell_style.text.line_space / 2;
                            p2.y = txt_area.y1 + txt_size.y + cell_style.text.line_space / 2;
                            lv_draw_line(&p1, &p2, mask, &cell_style, opa_scale);

                            ext->cell_data[cell][i] = '\n';
                        }
                    }
                }

                cell += col_merge + 1;
                col += col_merge;
            }
        }
    }
    /*Post draw when the children are drawn*/
    else if(mode == LV_DESIGN_DRAW_POST) {
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x2, %eax
jne 0x1a0da
movb $0x0, -0x1(%rbp)
jmp 0x1a7b9
movzbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x1a7a6
movq 0x6f30a(%rip), %rax     # 0x893f8
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movzbl -0x19(%rbp), %edx
callq *%rax
movq -0x10(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa080
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa710
movb %al, -0x48(%rbp)
movw $0x0, -0x4e(%rbp)
movq -0x10(%rbp), %rax
movswl 0x22(%rax), %eax
movq -0x30(%rbp), %rcx
movswl 0x16(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x38(%rbp)
movw $0x0, -0x4c(%rbp)
movzwl -0x4c(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1a7a4
movq -0x10(%rbp), %rdi
movzwl -0x4c(%rbp), %esi
callq 0x1b900
movw %ax, -0x32(%rbp)
movswl -0x38(%rbp), %eax
addl $0x1, %eax
movw %ax, -0x3c(%rbp)
movswl -0x3c(%rbp), %eax
movswl -0x32(%rbp), %ecx
addl %ecx, %eax
subl $0x1, %eax
movw %ax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movswl 0x20(%rax), %eax
movq -0x30(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x3a(%rbp)
movw $0x0, -0x4a(%rbp)
movzwl -0x4a(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x1a791
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
je 0x1a1de
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movb (%rax), %al
movb %al, -0x4f(%rbp)
jmp 0x1a206
movb -0x4f(%rbp), %al
andb $-0x5, %al
orb $0x0, %al
movb %al, -0x4f(%rbp)
movb -0x4f(%rbp), %al
andb $-0x4, %al
orb $0x0, %al
movb %al, -0x4f(%rbp)
movb -0x4f(%rbp), %al
andb $-0x19, %al
orb $0x0, %al
movb %al, -0x4f(%rbp)
movb -0x4f(%rbp), %al
andb $-0x21, %al
orb $0x20, %al
movb %al, -0x4f(%rbp)
movq -0x28(%rbp), %rax
movb -0x4f(%rbp), %cl
shrb $0x3, %cl
andb $0x3, %cl
movzbl %cl, %ecx
movq 0x10(%rax,%rcx,8), %rsi
leaq -0x98(%rbp), %rdi
callq 0xc550
movswl -0x3a(%rbp), %eax
addl $0x1, %eax
movw %ax, -0x3e(%rbp)
movswl -0x3e(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl -0x4a(%rbp), %edx
movswl 0x30(%rcx,%rdx,2), %ecx
addl %ecx, %eax
subl $0x1, %eax
movw %ax, -0x3a(%rbp)
movw $0x0, -0x9a(%rbp)
movw $0x0, -0x9a(%rbp)
movzwl -0x9a(%rbp), %eax
movzwl -0x4a(%rbp), %ecx
addl %ecx, %eax
movq -0x28(%rbp), %rcx
movzwl (%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1a310
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movzwl -0x9a(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x1a2f5
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movzwl -0x9a(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movb (%rax), %al
movb %al, -0x4f(%rbp)
movb -0x4f(%rbp), %al
shrb $0x2, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x1a2f1
movq -0x28(%rbp), %rax
movzwl -0x4a(%rbp), %ecx
movzwl -0x9a(%rbp), %edx
addl %edx, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movswl 0x30(%rax,%rcx,2), %ecx
movswl -0x3a(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x3a(%rbp)
jmp 0x1a2f3
jmp 0x1a310
jmp 0x1a2f7
jmp 0x1a310
jmp 0x1a2f9
movw -0x9a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x9a(%rbp)
jmp 0x1a25e
movq -0x18(%rbp), %rsi
leaq -0x3e(%rbp), %rdi
leaq -0x98(%rbp), %rdx
movzbl -0x48(%rbp), %ecx
callq 0x5a9e0
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
je 0x1a75b
movswl -0x3e(%rbp), %eax
movswl -0x7e(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x46(%rbp)
movswl -0x3a(%rbp), %eax
movswl -0x7c(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x42(%rbp)
movswl -0x3c(%rbp), %eax
movswl -0x82(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x44(%rbp)
movswl -0x38(%rbp), %eax
movswl -0x80(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x40(%rbp)
movb -0x4f(%rbp), %al
shrb $0x5, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x1a390
movb $0x0, -0x47(%rbp)
jmp 0x1a394
movb $0x2, -0x47(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movq (%rax,%rcx,8), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0xc0(%rbp)
movw -0x68(%rbp), %ax
movw %ax, -0xb2(%rbp)
movw -0x66(%rbp), %ax
movw %ax, -0xb0(%rbp)
leaq -0x46(%rbp), %rdi
callq 0x1bc00
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
movw -0xb2(%rbp), %cx
movw -0xb0(%rbp), %r8w
leaq -0x36(%rbp), %rdi
movswl %cx, %ecx
movswl %r8w, %r8d
movswl %ax, %r9d
movzbl -0x47(%rbp), %eax
movl %eax, (%rsp)
callq 0x46820
movb -0x4f(%rbp), %al
shrb $0x5, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x1a4a5
movswl -0x3c(%rbp), %eax
movl %eax, -0xd8(%rbp)
movswl -0x32(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xd8(%rbp), %eax
addl %ecx, %eax
movl %eax, -0xd4(%rbp)
movswl -0x34(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xd4(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x44(%rbp)
movswl -0x3c(%rbp), %eax
movl %eax, -0xd0(%rbp)
movswl -0x32(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xd0(%rbp), %eax
addl %ecx, %eax
movl %eax, -0xcc(%rbp)
movswl -0x34(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xcc(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x40(%rbp)
movzbl -0x4f(%rbp), %eax
andl $0x3, %eax
movl %eax, -0xdc(%rbp)
je 0x1a4d2
jmp 0x1a4b6
movl -0xdc(%rbp), %eax
subl $0x1, %eax
je 0x1a4ea
jmp 0x1a4c3
movl -0xdc(%rbp), %eax
subl $0x2, %eax
je 0x1a4de
jmp 0x1a4d0
jmp 0x1a4d2
movzbl -0x47(%rbp), %eax
orl $0x0, %eax
movb %al, -0x47(%rbp)
jmp 0x1a4f4
movzbl -0x47(%rbp), %eax
orl $0x8, %eax
movb %al, -0x47(%rbp)
jmp 0x1a4f4
movzbl -0x47(%rbp), %eax
orl $0x4, %eax
movb %al, -0x47(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xa2(%rbp), %rdi
leaq -0x3e(%rbp), %rdx
callq 0x427d0
andb $0x1, %al
movb %al, -0xa3(%rbp)
testb $0x1, -0xa3(%rbp)
je 0x1a5a9
movb -0x48(%rbp), %al
movb %al, -0xe9(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movq (%rax,%rcx,8), %rax
addq $0x1, %rax
movq %rax, -0xe8(%rbp)
movb -0x47(%rbp), %al
movb %al, -0xdd(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7180
movb -0xe9(%rbp), %cl
movq -0xe8(%rbp), %r8
movb -0xdd(%rbp), %r9b
leaq -0x46(%rbp), %rdi
leaq -0xa2(%rbp), %rsi
leaq -0x98(%rbp), %rdx
xorl %r10d, %r10d
movzbl %cl, %ecx
movzbl %r9b, %r9d
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x5f210
movw -0x3e(%rbp), %ax
movw %ax, -0xa8(%rbp)
movw -0x3a(%rbp), %ax
movw %ax, -0xac(%rbp)
movw $0x1, -0xae(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movzwl -0xae(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x1a759
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movzwl -0xae(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x1a740
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movzwl -0xae(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movq (%rax,%rcx,8), %rax
addq $0x1, %rax
movq %rax, -0x108(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x100(%rbp)
movw -0x68(%rbp), %ax
movw %ax, -0xf8(%rbp)
movw -0x66(%rbp), %ax
movw %ax, -0xf6(%rbp)
leaq -0x46(%rbp), %rdi
callq 0x1bc00
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
movw -0xf8(%rbp), %cx
movw -0xf6(%rbp), %r8w
leaq -0x36(%rbp), %rdi
movswl %cx, %ecx
movswl %r8w, %r8d
movswl %ax, %r9d
movzbl -0x47(%rbp), %eax
movl %eax, (%rsp)
callq 0x46820
movswl -0x44(%rbp), %eax
movswl -0x34(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0xf4(%rbp)
movswl -0x66(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xf4(%rbp), %eax
addl %ecx, %eax
movw %ax, -0xa6(%rbp)
movswl -0x44(%rbp), %eax
movswl -0x34(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0xf0(%rbp)
movswl -0x66(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xf0(%rbp), %eax
addl %ecx, %eax
movw %ax, -0xaa(%rbp)
movq -0x18(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
leaq -0xac(%rbp), %rsi
leaq -0x98(%rbp), %rcx
movzbl -0x48(%rbp), %r8d
callq 0x5fcd0
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x4e(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movzwl -0xae(%rbp), %ecx
movb $0xa, (%rax,%rcx)
jmp 0x1a742
movw -0xae(%rbp), %ax
addw $0x1, %ax
movw %ax, -0xae(%rbp)
jmp 0x1a5c8
jmp 0x1a75b
movzwl -0x9a(%rbp), %ecx
addl $0x1, %ecx
movzwl -0x4e(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x4e(%rbp)
movzwl -0x9a(%rbp), %ecx
movzwl -0x4a(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x4a(%rbp)
movw -0x4a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x4a(%rbp)
jmp 0x1a1a1
jmp 0x1a793
movw -0x4c(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x4c(%rbp)
jmp 0x1a144
jmp 0x1a7b3
movzbl -0x19(%rbp), %eax
cmpl $0x1, %eax
jne 0x1a7b1
jmp 0x1a7b1
jmp 0x1a7b3
jmp 0x1a7b5
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)