// File: /workspace/github_c_makefile_star2_O3/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 0x80e4
testb %al, %al
je 0x12fa6
movq %rbx, %rdi
callq 0x6af7
movq %rax, %r14
movzwl 0x58(%rax), %eax
testl %eax, %eax
je 0x12fd9
movq 0x50(%r14), %rcx
movl %eax, %edx
xorl %esi, %esi
movl $0x1, %r8d
xorl %edi, %edi
cmpw %r12w, (%rcx,%rsi,4)
jne 0x12eaf
cmpw %r15w, 0x2(%rcx,%rsi,4)
movzbl %dil, %edi
cmovel %r8d, %edi
incq %rsi
cmpq %rsi, %rdx
jne 0x12e9a
movl %eax, 0xc(%rsp)
testb $0x1, %dil
je 0x12fd9
movw %r12w, 0x5c(%r14)
movw %r15w, 0x5e(%r14)
movq %rbx, %rdi
callq 0x566d
movl %eax, %r13d
imull %r12d, %r13d
negl %r13d
movq %rbx, %rdi
callq 0x5697
movl %eax, %r12d
imull %r15d, %r12d
negl %r12d
movq %rbx, %rdi
callq 0x2695e
movq %rax, %r15
testb %bpl, %bpl
je 0x12fb7
movq %r15, %rdi
callq 0x4bdd
movl %eax, %ebp
movq %r15, %rdi
callq 0x4c15
movq %r15, 0x10(%rsp)
leaq -0xda4a(%rip), %rcx     # 0x54db
movq %rcx, 0x18(%rsp)
leaq 0x16c57(%rip), %rcx     # 0x29b88
movq %rcx, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movw $0x0, 0x3a(%rsp)
movzwl 0x5a(%r14), %ecx
movw %cx, 0x38(%rsp)
movl $0x0, 0x3c(%rsp)
movb $0x0, 0x40(%rsp)
cmpw %r13w, %bp
je 0x12f7e
movswl %bp, %edx
movl %eax, %ebp
movswl %r13w, %ecx
leaq 0x10(%rsp), %rdi
movl %edx, 0x20(%rdi)
movl %ecx, 0x24(%rdi)
callq 0x29bb4
movl %ebp, %eax
cmpw %r12w, %ax
je 0x12fc7
cwtl
movswl %r12w, %ecx
leaq 0x10(%rsp), %rdi
movl %eax, 0x20(%rdi)
movl %ecx, 0x24(%rdi)
leaq -0xda82(%rip), %rax     # 0x5519
movq %rax, 0x8(%rdi)
callq 0x29bb4
jmp 0x12fc7
leaq 0x2c237(%rip), %rdi     # 0x3f1e4
movq %rbx, %rsi
callq 0x8294
jmp 0x12fb5
movswl %r13w, %esi
movswl %r12w, %edx
movq %r15, %rdi
callq 0x4ad8
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
movl $0xe, %esi
callq 0x5018
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq