// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_tileview.c
// Function: lv_tileview_set_tile_act
void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim)
{
    LV_ASSERT_OBJ(tileview, LV_OBJX_NAME);

#if LV_USE_ANIMATION == 0
    anim = LV_ANIM_OFF;
#endif

    lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);

    uint32_t tile_id;
    bool valid = false;
    for(tile_id = 0; tile_id < ext->valid_pos_cnt; tile_id++) {
        if(ext->valid_pos[tile_id].x == x && ext->valid_pos[tile_id].y == y) {
            valid = true;
        }
    }

    if(valid == false) return; /*Don't load not valid tiles*/

    ext->act_id.x = x;
    ext->act_id.y = y;

    lv_coord_t x_coord = -x * lv_obj_get_width(tileview);
    lv_coord_t y_coord = -y * lv_obj_get_height(tileview);
    lv_obj_t * scrl    = lv_page_get_scrl(tileview);
    if(anim) {
#if LV_USE_ANIMATION
        lv_coord_t x_act = lv_obj_get_x(scrl);
        lv_coord_t y_act = lv_obj_get_y(scrl);

        lv_anim_t a;
        a.var            = scrl;
        a.exec_cb        = (lv_anim_exec_xcb_t)lv_obj_set_x;
        a.path_cb        = lv_anim_path_linear;
        a.ready_cb       = NULL;
        a.act_time       = 0;
        a.time           = ext->anim_time;
        a.playback       = 0;
        a.playback_pause = 0;
        a.repeat         = 0;
        a.repeat_pause   = 0;

        if(x_coord != x_act) {
            a.start = x_act;
            a.end   = x_coord;
            lv_anim_create(&a);
        }

        if(y_coord != y_act) {
            a.start   = y_act;
            a.end     = y_coord;
            a.exec_cb = (lv_anim_exec_xcb_t)lv_obj_set_y;
            lv_anim_create(&a);
        }
#endif
    } else {
        lv_obj_set_pos(scrl, x_coord, y_coord);
    }

    lv_res_t res = LV_RES_OK;
    res          = lv_event_send(tileview, LV_EVENT_VALUE_CHANGED, &tile_id);
    if(res != LV_RES_OK) return; /*Prevent the tile loading*/
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %rbx
callq 0x80d4
testb %al, %al
je 0x12f73
movq %rbx, %rdi
callq 0x6ad8
movq %rax, %r14
movzwl 0x58(%rax), %eax
testl %eax, %eax
je 0x12f84
movq 0x50(%r14), %rcx
movl %eax, %edx
xorl %esi, %esi
movl $0x1, %r8d
xorl %edi, %edi
cmpw %r12w, (%rcx,%rsi,4)
jne 0x12e7c
cmpw %r15w, 0x2(%rcx,%rsi,4)
movzbl %dil, %edi
cmovel %r8d, %edi
incq %rsi
cmpq %rsi, %rdx
jne 0x12e67
movl %eax, 0xc(%rsp)
testb $0x1, %dil
je 0x12fb0
movw %r12w, 0x5c(%r14)
movw %r15w, 0x5e(%r14)
movq %rbx, %rdi
callq 0x5651
movl %eax, %r13d
imull %r12d, %r13d
negl %r13d
movq %rbx, %rdi
callq 0x567b
movl %eax, %r12d
imull %r15d, %r12d
negl %r12d
movq %rbx, %rdi
callq 0x26288
movq %rax, %r15
testb %bpl, %bpl
je 0x12f8e
movq %r15, %rdi
callq 0x4bc6
movl %eax, %ebp
movq %r15, %rdi
callq 0x4bfe
movq %r15, 0x10(%rsp)
leaq -0xda2f(%rip), %rcx     # 0x54c3
movq %rcx, 0x18(%rsp)
leaq 0x165f7(%rip), %rcx     # 0x294f5
movq %rcx, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movw $0x0, 0x3a(%rsp)
movzwl 0x5a(%r14), %ecx
movw %cx, 0x38(%rsp)
movl $0x0, 0x3c(%rsp)
andb $-0x4, 0x40(%rsp)
cmpw %r13w, %bp
je 0x12f4b
movswl %bp, %edx
movl %eax, %ebp
movswl %r13w, %ecx
leaq 0x10(%rsp), %rdi
movl %edx, 0x20(%rdi)
movl %ecx, 0x24(%rdi)
callq 0x29521
movl %ebp, %eax
cmpw %r12w, %ax
je 0x12f9e
cwtl
movswl %r12w, %ecx
leaq 0x10(%rsp), %rdi
movl %eax, 0x20(%rdi)
movl %ecx, 0x24(%rdi)
leaq -0xda67(%rip), %rax     # 0x5501
movq %rax, 0x8(%rdi)
callq 0x29521
jmp 0x12f9e
leaq 0x2c1ba(%rip), %rdi     # 0x3f134
movq %rbx, %rsi
callq 0x829e
jmp 0x12f82
movl $0x0, 0xc(%rsp)
jmp 0x12fb0
movswl %r13w, %esi
movswl %r12w, %edx
movq %r15, %rdi
callq 0x4ae2
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
movl $0xe, %esi
callq 0x4fea
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq