// File: /workspace/github_c_makefile_star2_O2/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 0x7994
testb %al, %al
je 0x120b0
movq %rbx, %rdi
callq 0x6747
movq %rax, %r14
movzwl 0x58(%rax), %eax
xorl %ecx, %ecx
pushq $0x1
popq %rsi
xorl %edx, %edx
cmpq %rcx, %rax
je 0x120c1
movq 0x50(%r14), %rdi
cmpw %r12w, (%rdi,%rcx,4)
jne 0x120ab
cmpw %r15w, 0x2(%rdi,%rcx,4)
movzbl %dl, %edx
cmovel %esi, %edx
incq %rcx
jmp 0x1208f
leaq 0x2908d(%rip), %rdi     # 0x3b144
movq %rbx, %rsi
callq 0x7b01
jmp 0x120bf
movl %eax, 0xc(%rsp)
testb $0x1, %dl
je 0x121ca
movw %r12w, 0x5c(%r14)
movw %r15w, 0x5e(%r14)
movq %rbx, %rdi
callq 0x5308
movl %eax, %r13d
imull %r12d, %r13d
negl %r13d
movq %rbx, %rdi
callq 0x5332
movl %eax, %r12d
imull %r15d, %r12d
negl %r12d
movq %rbx, %rdi
callq 0x245d9
movq %rax, %r15
testb %bpl, %bpl
je 0x121aa
movq %r15, %rdi
callq 0x48ca
movl %eax, %ebp
movq %r15, %rdi
callq 0x4902
movq %r15, 0x10(%rsp)
leaq -0xcf9c(%rip), %rcx     # 0x5192
movq %rcx, 0x18(%rsp)
leaq 0x1551f(%rip), %rcx     # 0x27659
movq %rcx, 0x20(%rsp)
andq $0x0, 0x28(%rsp)
andw $0x0, 0x3a(%rsp)
movzwl 0x5a(%r14), %ecx
movw %cx, 0x38(%rsp)
andl $0x0, 0x3c(%rsp)
movl %eax, %r14d
movb $0x0, 0x40(%rsp)
cmpw %r13w, %bp
je 0x1217f
movswl %bp, %eax
movswl %r13w, %ecx
leaq 0x10(%rsp), %rdi
movl %eax, 0x20(%rdi)
movl %ecx, 0x24(%rdi)
callq 0x27685
cmpw %r12w, %r14w
je 0x121ba
movswl %r14w, %eax
movswl %r12w, %ecx
leaq 0x10(%rsp), %rdi
movl %eax, 0x20(%rdi)
movl %ecx, 0x24(%rdi)
leaq -0xcfcf(%rip), %rax     # 0x51d0
movq %rax, 0x8(%rdi)
callq 0x27685
jmp 0x121ba
movswl %r13w, %esi
movswl %r12w, %edx
movq %r15, %rdi
callq 0x47df
pushq $0xe
popq %rsi
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
callq 0x4caf
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq