// File: /workspace/github_c_makefile_star2_O1/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, %ebx
callq 0x6ad8
movq %rax, %r14
movzwl (%rax), %edx
movq 0x10(%rax), %rcx
movq 0x28(%rcx), %rax
movzbl 0x10(%rax), %eax
addw 0x16(%rcx), %ax
addw 0x18(%rcx), %ax
imull %edx, %ebx
movzwl %bx, %edi
leal (%rdx,%rdi), %ecx
cmpl %edi, %ecx
jbe 0x10a7d
xorl %ecx, %ecx
movl %edi, %r8d
movq %rdi, 0x8(%rsp)
movq 0x8(%r14), %r9
movzwl %bx, %esi
movq (%r9,%rsi,8), %rsi
testq %rsi, %rsi
je 0x10a65
movzwl %cx, %r11d
movzwl 0x30(%r14,%r11,2), %edi
decl %edx
xorl %r13d, %r13d
cmpl %r11d, %edx
jle 0x109bc
movl %r11d, %ebp
xorl %r10d, %r10d
addl %r8d, %r13d
movq (%r9,%r13,8), %r15
testq %r15, %r15
je 0x109b7
movb (%r15), %r15b
testb $0x4, %r15b
je 0x109a2
movl %ebp, %r12d
addw 0x32(%r14,%r12,2), %di
testb $0x4, %r15b
je 0x109b7
incl %r10d
movzwl %r10w, %r13d
leal (%r11,%r13), %ebp
cmpl %edx, %ebp
jl 0x10984
movl %r10d, %r13d
jmp 0x109be
movl %ecx, %ebp
movzbl (%rsi), %edx
movl %edx, %r8d
andl $0x18, %r8d
movq 0x10(%r14,%r8), %r12
movswl %ax, %r15d
testb $0x20, %dl
jne 0x10a36
movzwl 0x1a(%r12), %eax
addw 0x1c(%r12), %ax
subl %eax, %edi
incq %rsi
movq 0x28(%r12), %rdx
movswl 0x30(%r12), %ecx
movswl 0x32(%r12), %r8d
movl $0x0, (%rsp)
movswl %di, %r9d
leaq 0x14(%rsp), %rdi
callq 0x2a643
movswl 0x16(%rsp), %eax
movswl 0x16(%r12), %ecx
addl %eax, %ecx
movswl 0x18(%r12), %eax
addl %ecx, %eax
cmpl %r15d, %eax
cmovgl %eax, %r15d
addl %ebx, %r13d
movl %ebp, %ecx
movl %r15d, %eax
movl %r13d, %ebx
jmp 0x10a60
movq 0x28(%r12), %rdx
movzbl 0x10(%rdx), %edi
movswl 0x16(%r12), %esi
movswl 0x18(%r12), %edx
leal (%rsi,%rdx), %r8d
addl %edi, %r8d
cmpl %r15d, %r8d
jle 0x10a60
movzwl %di, %eax
addl %esi, %edx
addl %eax, %edx
movl %edx, %eax
movq 0x8(%rsp), %rdi
incl %ebx
incl %ecx
movzwl %bx, %r8d
movzwl (%r14), %edx
leal (%rdx,%rdi), %esi
cmpl %r8d, %esi
ja 0x10956
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq