// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_table.c
// Function: get_row_height
static lv_coord_t get_row_height(lv_obj_t * table, uint16_t row_id)
{
    lv_table_ext_t * ext = lv_obj_get_ext_attr(table);
    lv_point_t txt_size;
    lv_coord_t txt_w;
    const lv_style_t * cell_style;

    uint16_t row_start = row_id * ext->col_cnt;
    uint16_t cell;
    uint16_t col;
    lv_coord_t h_max = lv_font_get_line_height(ext->cell_style[0]->text.font) + ext->cell_style[0]->body.padding.top +
                       ext->cell_style[0]->body.padding.bottom;

    for(cell = row_start, col = 0; cell < row_start + ext->col_cnt; cell++, col++) {
        if(ext->cell_data[cell] != NULL) {

            txt_w              = ext->col_w[col];
            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) {
                    lv_table_cell_format_t format;
                    format.format_byte = ext->cell_data[cell + col_merge][0];
                    if(format.s.right_merge)
                        txt_w += ext->col_w[col + col_merge + 1];
                    else
                        break;
                } else {
                    break;
                }
            }

            lv_table_cell_format_t format;
            format.format_byte = ext->cell_data[cell][0];
            cell_style         = ext->cell_style[format.s.type];

            /*With text crop assume 1 line*/
            if(format.s.crop) {
                h_max = LV_MATH_MAX(lv_font_get_line_height(cell_style->text.font) + cell_style->body.padding.top +
                                        cell_style->body.padding.bottom,
                                    h_max);
            }
            /*Without text crop calculate the height of the text in the cell*/
            else {
                txt_w -= cell_style->body.padding.left + cell_style->body.padding.right;

                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, txt_w, LV_TXT_FLAG_NONE);

                h_max = LV_MATH_MAX(txt_size.y + cell_style->body.padding.top + cell_style->body.padding.bottom, h_max);
                cell += col_merge;
                col += col_merge;
            }
        }
    }

    return h_max;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
callq 0x6747
movq %rax, %r14
movl (%rax), %edi
movq 0x10(%rax), %rcx
movq 0x28(%rcx), %rdx
movzbl 0x10(%rdx), %ebx
addw 0x16(%rcx), %bx
addw 0x18(%rcx), %bx
imull %edi, %ebp
movzwl %bp, %ecx
movq %rcx, 0x20(%rsp)
xorl %ecx, %ecx
movzwl %bp, %edx
movzwl %di, %r8d
movq 0x20(%rsp), %rsi
addl %r8d, %esi
cmpl %edx, %esi
jbe 0xfe2d
movq 0x8(%r14), %r9
movq (%r9,%rdx,8), %rsi
testq %rsi, %rsi
je 0xfe24
movl %edi, 0x18(%rsp)
movzwl %cx, %r10d
movzwl 0x30(%r14,%r10,2), %edi
decl %r8d
xorl %r13d, %r13d
movzwl %r13w, %r13d
leal (%r10,%r13), %r15d
cmpl %r8d, %r15d
jge 0xfd88
leal (%rdx,%r13), %r11d
movq (%r9,%r11,8), %r11
testq %r11, %r11
je 0xfd88
testb $0x4, (%r11)
je 0xfd88
movl %r15d, %r11d
addw 0x32(%r14,%r11,2), %di
incl %r13d
jmp 0xfd5a
movl %ebp, 0x14(%rsp)
movzbl (%rsi), %edx
movl %edx, %r8d
andl $0x18, %r8d
movq 0x10(%r14,%r8), %rbp
movswl %bx, %r12d
testb $0x20, %dl
jne 0xfdf7
movzwl 0x1a(%rbp), %eax
addw 0x1c(%rbp), %ax
subl %eax, %edi
incq %rsi
movq 0x28(%rbp), %rdx
movswl 0x30(%rbp), %ecx
movswl 0x32(%rbp), %r8d
andl $0x0, (%rsp)
movswl %di, %r9d
leaq 0x1c(%rsp), %rdi
callq 0x28723
movswl 0x1e(%rsp), %eax
movswl 0x16(%rbp), %ecx
addl %eax, %ecx
movswl 0x18(%rbp), %eax
addl %ecx, %eax
cmpl %r12d, %eax
cmovgl %eax, %ebx
movl 0x14(%rsp), %ebp
addl %r13d, %ebp
movzwl (%r14), %edi
movl %r15d, %ecx
jmp 0xfe24
movq 0x28(%rbp), %rdx
movzbl 0x10(%rdx), %edi
movswl 0x16(%rbp), %esi
movswl 0x18(%rbp), %edx
leal (%rsi,%rdx), %r8d
addl %edi, %r8d
cmpl %r12d, %r8d
jle 0xfe1c
movzwl %di, %edi
addl %esi, %edx
addl %edi, %edx
movl %edx, %ebx
movl 0x14(%rsp), %ebp
movl 0x18(%rsp), %edi
incl %ebp
incl %ecx
jmp 0xfd1e
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop