// File: /workspace/github_c_makefile_star2_O3/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 0x25398
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x12628
testq %rbx, %rbx
je 0x12639
movq %rbx, %rdi
movl $0x68, %esi
callq 0x64db
movq %rax, %r14
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x12649
testq %r14, %r14
je 0x12639
cmpq $0x0, 0x4ddc8(%rip)     # 0x60348
jne 0x12591
movq %rbx, %rdi
callq 0x6a8b
movq %rax, 0x4ddb7(%rip)     # 0x60348
cmpq $0x0, 0x4ddb7(%rip)     # 0x60350
jne 0x125b2
movq %rbx, %rdi
callq 0x2695e
movq %rax, %rdi
callq 0x6a8b
movq %rax, 0x4dd9e(%rip)     # 0x60350
cmpq $0x0, 0x4dd9e(%rip)     # 0x60358
jne 0x125cb
movq %rbx, %rdi
callq 0x6aaf
movq %rax, 0x4dd8d(%rip)     # 0x60358
movq $0x0, 0x50(%r14)
movq $0x12c0000, 0x58(%r14)  # imm = 0x12C0000
leaq 0x15b(%rip), %rsi       # 0x1273d
movq %rbx, %rdi
callq 0x647b
movq %rbx, %rdi
callq 0x2695e
leaq 0x17c(%rip), %rsi       # 0x12775
movq %rax, %rdi
callq 0x647b
testq %r15, %r15
je 0x1265a
movq %r15, %rdi
callq 0x6af7
movq 0x50(%rax), %rcx
movq %rcx, 0x50(%r14)
movq 0x58(%rax), %rax
movq %rax, 0x58(%r14)
movq %rbx, %rdi
callq 0x5e54
jmp 0x1263b
leaq 0x2caa1(%rip), %rdi     # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0x12637
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ca80(%rip), %rdi     # 0x3f0d0
movq %r14, %rsi
callq 0x8294
jmp 0x12658
movq %rbx, %rdi
callq 0x4ab5
movq %rax, %rdi
callq 0x6772
movl %eax, %ebp
movq %rbx, %rdi
callq 0x4ab5
movq %rax, %rdi
callq 0x67ba
movswl %bp, %esi
movswl %ax, %edx
movq %rbx, %rdi
callq 0x5557
movq %rbx, %rdi
callq 0x2695e
movq %rax, %rdi
xorl %esi, %esi
callq 0x6119
movq %rbx, %rdi
callq 0x2695e
movq %rax, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x22d84
movq 0x8(%r14), %rdi
leaq 0x436(%rip), %rsi       # 0x12b02
callq 0x6363
callq 0x2e91c
testq %rax, %rax
je 0x12714
movq %rax, %r14
movq 0x2f8(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2640b
movq 0x300(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x2640b
movq 0x308(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
jmp 0x12733
leaq 0x4d9ad(%rip), %r14     # 0x600c8
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x2640b
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x2640b
jmp 0x1263b