// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_table.c
// Function: lv_table_create
lv_obj_t * lv_table_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("table create started");

    /*Create the ancestor of table*/
    lv_obj_t * new_table = lv_obj_create(par, copy);
    LV_ASSERT_MEM(new_table);
    if(new_table == NULL) return NULL;

    /*Allocate the table type specific extended data*/
    lv_table_ext_t * ext = lv_obj_allocate_ext_attr(new_table, sizeof(lv_table_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;
    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_table);
    if(ancestor_scrl_design == NULL) ancestor_scrl_design = lv_obj_get_design_cb(new_table);

    /*Initialize the allocated 'ext' */
    ext->cell_data     = NULL;
    ext->cell_style[0] = &lv_style_plain;
    ext->cell_style[1] = &lv_style_plain;
    ext->cell_style[2] = &lv_style_plain;
    ext->cell_style[3] = &lv_style_plain;
    ext->col_cnt       = 0;
    ext->row_cnt       = 0;

    uint16_t i;
    for(i = 0; i < LV_TABLE_COL_MAX; i++) {
        ext->col_w[i] = LV_DPI;
    }

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_table, lv_table_signal);
    lv_obj_set_design_cb(new_table, lv_table_design);

    /*Init the new table table*/
    if(copy == NULL) {
        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_table_set_style(new_table, LV_TABLE_STYLE_BG, th->style.table.bg);
            lv_table_set_style(new_table, LV_TABLE_STYLE_CELL1, th->style.table.cell);
            lv_table_set_style(new_table, LV_TABLE_STYLE_CELL2, th->style.table.cell);
            lv_table_set_style(new_table, LV_TABLE_STYLE_CELL3, th->style.table.cell);
            lv_table_set_style(new_table, LV_TABLE_STYLE_CELL4, th->style.table.cell);
        } else {
            lv_table_set_style(new_table, LV_TABLE_STYLE_BG, &lv_style_plain_color);
        }
        lv_obj_set_click(new_table, false); /*Can be removed if click support is added*/
    }
    /*Copy an existing table*/
    else {
        lv_table_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->cell_style[0]        = copy_ext->cell_style[0];
        ext->cell_style[1]        = copy_ext->cell_style[1];
        ext->cell_style[2]        = copy_ext->cell_style[2];
        ext->cell_style[3]        = copy_ext->cell_style[3];
        lv_table_set_row_cnt(new_table, copy_ext->row_cnt);
        lv_table_set_col_cnt(new_table, copy_ext->col_cnt);

        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_table);
    }

    LV_LOG_INFO("table created");

    return new_table;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
callq 0x42c9
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0xed4f
testq %rbx, %rbx
je 0xed60
pushq $0x48
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r15
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0xed6b
testq %r15, %r15
je 0xed60
cmpq $0x0, 0x4f630(%rip)     # 0x5e320
jne 0xed01
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x4f61f(%rip)     # 0x5e320
cmpq $0x0, 0x4f61f(%rip)     # 0x5e328
jne 0xed1a
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x4f60e(%rip)     # 0x5e328
andq $0x0, 0x8(%r15)
leaq 0x4f1f2(%rip), %rax     # 0x5df18
movq %rax, 0x10(%r15)
movq %rax, 0x18(%r15)
movq %rax, 0x20(%r15)
movq %rax, 0x28(%r15)
andl $0x0, (%r15)
xorl %eax, %eax
cmpq $0xc, %rax
je 0xed7c
movw $0x64, 0x30(%r15,%rax,2)
incq %rax
jmp 0xed3c
leaq 0x2c2ea(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0xed5e
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2c2ce(%rip), %rdi     # 0x3b040
movq %r15, %rsi
callq 0x7b01
jmp 0xed7a
leaq 0xf0(%rip), %rsi        # 0xee73
movq %rbx, %rdi
callq 0x60e6
leaq 0x17d(%rip), %rsi       # 0xef0f
movq %rbx, %rdi
callq 0x6116
testq %r14, %r14
je 0xedf0
movq %r14, %rdi
callq 0x6747
movq %rax, %r14
movq 0x10(%rax), %rax
movq %rax, 0x10(%r15)
movq 0x18(%r14), %rax
movq %rax, 0x18(%r15)
movq 0x20(%r14), %rax
movq %rax, 0x20(%r15)
movq 0x28(%r14), %rax
movq %rax, 0x28(%r15)
movzwl 0x2(%r14), %esi
movq %rbx, %rdi
callq 0xf3b4
movzwl (%r14), %esi
movq %rbx, %rdi
callq 0xf461
movq %rbx, %rdi
callq 0x5ae7
jmp 0xed62
callq 0x2be75
testq %rax, %rax
je 0xee53
movq %rax, %r14
movq 0x310(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xf338
movq 0x318(%r14), %rdx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xf338
movq 0x318(%r14), %rdx
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0xf338
movq 0x318(%r14), %rdx
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0xf338
movq 0x318(%r14), %rdx
pushq $0x4
popq %rsi
movq %rbx, %rdi
jmp 0xee5f
leaq 0x4f106(%rip), %rdx     # 0x5df60
movq %rbx, %rdi
xorl %esi, %esi
callq 0xf338
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5c6f
jmp 0xed62