// File: /workspace/github_c_makefile_star2_O1/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 0x24c9c
movq %rax, %rbx
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x1262c
testq %rbx, %rbx
je 0x1263d
movq %rbx, %rdi
movl $0x68, %esi
callq 0x64bc
movq %rax, %r14
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x1264d
testq %r14, %r14
je 0x1263d
cmpq $0x0, 0x4dde0(%rip)     # 0x60348
jne 0x12579
movq %rbx, %rdi
callq 0x6a6c
movq %rax, 0x4ddcf(%rip)     # 0x60348
cmpq $0x0, 0x4ddcf(%rip)     # 0x60350
jne 0x1259a
movq %rbx, %rdi
callq 0x26288
movq %rax, %rdi
callq 0x6a6c
movq %rax, 0x4ddb6(%rip)     # 0x60350
cmpq $0x0, 0x4ddb6(%rip)     # 0x60358
jne 0x125b3
movq %rbx, %rdi
callq 0x6a90
movq %rax, 0x4dda5(%rip)     # 0x60358
movq $0x0, 0x50(%r14)
movq $0x12c0000, 0x58(%r14)  # imm = 0x12C0000
leaq 0x177(%rip), %rsi       # 0x12741
movq %rbx, %rdi
callq 0x645c
movq %rbx, %rdi
callq 0x26288
leaq 0x198(%rip), %rsi       # 0x12779
movq %rax, %rdi
callq 0x645c
testq %r15, %r15
je 0x1265e
movq %r15, %rdi
callq 0x6ad8
movzwl 0x5c(%rax), %ecx
movw %cx, 0x5c(%r14)
movzwl 0x5e(%rax), %ecx
movw %cx, 0x5e(%r14)
movq 0x50(%rax), %rcx
movq %rcx, 0x50(%r14)
movzwl 0x58(%rax), %ecx
movw %cx, 0x58(%r14)
movzwl 0x5a(%rax), %eax
movw %ax, 0x5a(%r14)
movq %rbx, %rdi
callq 0x5e38
jmp 0x1263f
leaq 0x2ca0d(%rip), %rdi     # 0x3f040
movq %rbx, %rsi
callq 0x829e
jmp 0x1263b
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2c9ec(%rip), %rdi     # 0x3f040
movq %r14, %rsi
callq 0x829e
jmp 0x1265c
movq %rbx, %rdi
callq 0x4abf
movq %rax, %rdi
callq 0x6753
movl %eax, %ebp
movq %rbx, %rdi
callq 0x4abf
movq %rax, %rdi
callq 0x679b
movswl %bp, %esi
movswl %ax, %edx
movq %rbx, %rdi
callq 0x553f
movq %rbx, %rdi
callq 0x26288
movq %rax, %rdi
xorl %esi, %esi
callq 0x60fa
movq %rbx, %rdi
callq 0x26288
movq %rax, %rdi
movl $0x1, %esi
movl $0x1, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x22602
movq 0x8(%r14), %rdi
leaq 0x41f(%rip), %rsi       # 0x12aef
callq 0x6344
callq 0x2e244
testq %rax, %rax
je 0x12718
movq %rax, %r14
movq 0x2f8(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x25d1f
movq 0x300(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x25d1f
movq 0x308(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
jmp 0x12737
leaq 0x4d9a9(%rip), %r14     # 0x600c8
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x25d1f
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x25d1f
jmp 0x1263f