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

    /*Create the ancestor of tileview*/
    lv_obj_t * new_tileview = lv_page_create(par, copy);
    LV_ASSERT_MEM(new_tileview);
    if(new_tileview == NULL) return NULL;

    /*Allocate the tileview type specific extended data*/
    lv_tileview_ext_t * ext = lv_obj_allocate_ext_attr(new_tileview, sizeof(lv_tileview_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;
    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_tileview);
    if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrl(new_tileview));
    if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_tileview);

        /*Initialize the allocated 'ext' */
#if LV_USE_ANIMATION
    ext->anim_time = LV_TILEVIEW_DEF_ANIM_TIME;
#endif
    ext->act_id.x      = 0;
    ext->act_id.y      = 0;
    ext->valid_pos     = NULL;
    ext->valid_pos_cnt = 0;

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_tileview, lv_tileview_signal);
    lv_obj_set_signal_cb(lv_page_get_scrl(new_tileview), lv_tileview_scrl_signal);

    /*Init the new tileview*/
    if(copy == NULL) {
        /* Set a size which fits into the parent.
         * Don't use `par` directly because if the tileview is created on a page it is moved to the
         * scrollable so the parent has changed */
        lv_obj_set_size(new_tileview, lv_obj_get_width_fit(lv_obj_get_parent(new_tileview)),
                        lv_obj_get_height_fit(lv_obj_get_parent(new_tileview)));

        lv_obj_set_drag_throw(lv_page_get_scrl(new_tileview), false);
        lv_page_set_scrl_fit(new_tileview, LV_FIT_TIGHT);
        lv_obj_set_event_cb(ext->page.scrl, tileview_scrl_event_cb);
        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_page_set_style(new_tileview, LV_PAGE_STYLE_BG, th->style.tileview.bg);
            lv_page_set_style(new_tileview, LV_PAGE_STYLE_SCRL, th->style.tileview.scrl);
            lv_page_set_style(new_tileview, LV_PAGE_STYLE_SB, th->style.tileview.sb);
        } else {
            lv_page_set_style(new_tileview, LV_PAGE_STYLE_BG, &lv_style_transp_tight);
            lv_page_set_style(new_tileview, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);
        }
    }
    /*Copy an existing tileview*/
    else {
        lv_tileview_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->act_id.x                = copy_ext->act_id.x;
        ext->act_id.y                = copy_ext->act_id.y;
        ext->valid_pos               = copy_ext->valid_pos;
        ext->valid_pos_cnt           = copy_ext->valid_pos_cnt;
#if LV_USE_ANIMATION
        ext->anim_time = copy_ext->anim_time;
#endif

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

    LV_LOG_INFO("tileview created");

    return new_tileview;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
callq 0x230ac
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x11887
testq %rbx, %rbx
je 0x11898
pushq $0x68
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r14
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x118a8
testq %r14, %r14
je 0x11898
cmpq $0x0, 0x4cb66(%rip)     # 0x5e348
jne 0x117f3
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x4cb55(%rip)     # 0x5e348
cmpq $0x0, 0x4cb55(%rip)     # 0x5e350
jne 0x11814
movq %rbx, %rdi
callq 0x245d9
movq %rax, %rdi
callq 0x66db
movq %rax, 0x4cb3c(%rip)     # 0x5e350
cmpq $0x0, 0x4cb3c(%rip)     # 0x5e358
jne 0x1182d
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x4cb2b(%rip)     # 0x5e358
andq $0x0, 0x50(%r14)
movq $0x12c0000, 0x58(%r14)  # imm = 0x12C0000
leaq 0x14a(%rip), %rsi       # 0x1198b
movq %rbx, %rdi
callq 0x60e6
movq %rbx, %rdi
callq 0x245d9
leaq 0x16b(%rip), %rsi       # 0x119c3
movq %rax, %rdi
callq 0x60e6
testq %r15, %r15
je 0x118b9
movq %r15, %rdi
callq 0x6747
movq 0x50(%rax), %rcx
movq %rcx, 0x50(%r14)
movq 0x58(%rax), %rax
movq %rax, 0x58(%r14)
movq %rbx, %rdi
callq 0x5ae7
jmp 0x1189a
leaq 0x297b2(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0x11896
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29791(%rip), %rdi     # 0x3b040
movq %r14, %rsi
callq 0x7b01
jmp 0x118b7
movq %rbx, %rdi
callq 0x47bc
movq %rax, %rdi
callq 0x63d0
movl %eax, %ebp
movq %rbx, %rdi
callq 0x47bc
movq %rax, %rdi
callq 0x6418
movswl %bp, %esi
movswl %ax, %edx
movq %rbx, %rdi
callq 0x520e
movq %rbx, %rdi
callq 0x245d9
movq %rax, %rdi
xorl %esi, %esi
callq 0x5d8d
movq %rbx, %rdi
callq 0x245d9
pushq $0x1
popq %rcx
movq %rax, %rdi
movl %ecx, %esi
movl %ecx, %edx
movl %ecx, %r8d
callq 0x20c30
movq 0x8(%r14), %rdi
leaq 0x437(%rip), %rsi       # 0x11d57
callq 0x5fce
callq 0x2be75
testq %rax, %rax
je 0x11964
movq %rax, %r14
movq 0x2f8(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x24089
movq 0x300(%r14), %rdx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x24089
movq 0x308(%r14), %rdx
pushq $0x2
popq %rsi
movq %rbx, %rdi
jmp 0x11981
leaq 0x4c75d(%rip), %r14     # 0x5e0c8
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x24089
pushq $0x1
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x24089
jmp 0x1189a