// File: /workspace/github_c_makefile_star2_O1/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 0x455f
movq %rax, %rbx
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0xf98a
testq %rbx, %rbx
je 0xf99b
movq %rbx, %rdi
movl $0x48, %esi
callq 0x64bc
movq %rax, %r15
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0xf9a6
testq %r15, %r15
je 0xf99b
cmpq $0x0, 0x50a6a(%rip)     # 0x60320
jne 0xf8c7
movq %rbx, %rdi
callq 0x6a6c
movq %rax, 0x50a59(%rip)     # 0x60320
cmpq $0x0, 0x50a59(%rip)     # 0x60328
jne 0xf8e0
movq %rbx, %rdi
callq 0x6a90
movq %rax, 0x50a48(%rip)     # 0x60328
movq $0x0, 0x8(%r15)
leaq 0x50629(%rip), %rax     # 0x5ff18
movq %rax, 0x10(%r15)
movq %rax, 0x18(%r15)
movq %rax, 0x20(%r15)
movq %rax, 0x28(%r15)
movl $0x0, (%r15)
xorl %eax, %eax
movw $0x64, 0x30(%r15,%rax,2)
incq %rax
cmpq $0xc, %rax
jne 0xf908
leaq 0x122(%rip), %rsi       # 0xfa42
movq %rbx, %rdi
callq 0x645c
leaq 0x1d3(%rip), %rsi       # 0xfb02
movq %rbx, %rdi
callq 0x648c
testq %r14, %r14
je 0xf9b7
movq %r14, %rdi
callq 0x6ad8
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 0xffec
movzwl (%r14), %esi
movq %rbx, %rdi
callq 0x1009c
movq %rbx, %rdi
callq 0x5e38
jmp 0xf99d
leaq 0x2f6af(%rip), %rdi     # 0x3f040
movq %rbx, %rsi
callq 0x829e
jmp 0xf999
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2f693(%rip), %rdi     # 0x3f040
movq %r15, %rsi
callq 0x829e
jmp 0xf9b5
callq 0x2e244
testq %rax, %rax
je 0xfa22
movq %rax, %r14
movq 0x310(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xff70
movq 0x318(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0xff70
movq 0x318(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0xff70
movq 0x318(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0xff70
movq 0x318(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
jmp 0xfa2e
leaq 0x50537(%rip), %rdx     # 0x5ff60
movq %rbx, %rdi
xorl %esi, %esi
callq 0xff70
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5fd8
jmp 0xf99d