// File: /workspace/github_c_makefile_star2_O3/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 $0x18, %rsp
movl %esi, %ebp
callq 0x6af7
movq %rax, %rbx
movq 0x10(%rax), %rcx
movq 0x28(%rcx), %rax
movzbl 0x10(%rax), %eax
addw 0x16(%rcx), %ax
movzwl (%rbx), %r8d
addw 0x18(%rcx), %ax
testl %r8d, %r8d
je 0x10aad
imull %r8d, %ebp
movzwl %bp, %edi
xorl %ecx, %ecx
movl %r8d, %edx
movq %rdi, 0x10(%rsp)
movl %edi, %r9d
movq 0x8(%rbx), %r10
movzwl %bp, %esi
movq (%r10,%rsi,8), %rsi
testq %rsi, %rsi
je 0x10a90
movzwl %cx, %r14d
movzwl 0x30(%rbx,%r14,2), %edi
decl %r8d
xorl %r13d, %r13d
cmpl %r14d, %r8d
jle 0x109ed
movl %r14d, %r12d
xorl %r11d, %r11d
addl %r9d, %r13d
movq (%r10,%r13,8), %r15
testq %r15, %r15
je 0x109e8
testb $0x4, (%r15)
je 0x109e8
movl %r12d, %r15d
addw 0x32(%rbx,%r15,2), %di
incl %r11d
movzwl %r11w, %r13d
leal (%r14,%r13), %r12d
cmpl %r8d, %r12d
jl 0x109bd
movl %r11d, %r13d
jmp 0x109f0
movl %ecx, %r12d
movzbl (%rsi), %r8d
movl %r8d, %r9d
andl $0x18, %r9d
movq 0x10(%rbx,%r9), %r15
movswl %ax, %r14d
testb $0x20, %r8b
jne 0x10a67
movzwl 0x1a(%r15), %eax
addw 0x1c(%r15), %ax
subl %eax, %edi
incq %rsi
movq 0x28(%r15), %rdx
movswl 0x30(%r15), %ecx
movswl 0x32(%r15), %r8d
movl $0x0, (%rsp)
movswl %di, %r9d
leaq 0xc(%rsp), %rdi
callq 0x2acd4
movswl 0xe(%rsp), %eax
movswl 0x16(%r15), %ecx
addl %eax, %ecx
movswl 0x18(%r15), %eax
addl %ecx, %eax
cmpl %r14d, %eax
cmovgl %eax, %r14d
addl %ebp, %r13d
movzwl (%rbx), %edx
movl %r12d, %ecx
movl %r14d, %eax
movl %r13d, %ebp
jmp 0x10a90
movq 0x28(%r15), %rsi
movzbl 0x10(%rsi), %r8d
movswl 0x16(%r15), %edi
movswl 0x18(%r15), %esi
leal (%rdi,%rsi), %r9d
addl %r8d, %r9d
cmpl %r14d, %r9d
jle 0x10a90
movzwl %r8w, %eax
addl %edi, %esi
addl %eax, %esi
movl %esi, %eax
incl %ebp
incl %ecx
movzwl %bp, %r9d
movzwl %dx, %r8d
movq 0x10(%rsp), %rsi
addl %r8d, %esi
cmpl %r9d, %esi
ja 0x1098e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq