// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_roller.c
// Function: refr_position
static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en)
{
#if LV_USE_ANIMATION == 0
    anim_en = LV_ANIM_OFF;
#endif

    lv_obj_t * roller_scrl         = lv_page_get_scrl(roller);
    lv_roller_ext_t * ext          = lv_obj_get_ext_attr(roller);
    const lv_style_t * style_label = lv_obj_get_style(ext->ddlist.label);
    const lv_font_t * font         = style_label->text.font;
    lv_coord_t font_h              = lv_font_get_line_height(font);
    lv_coord_t h                   = lv_obj_get_height(roller);
    uint16_t anim_time             = lv_roller_get_anim_time(roller);

    /* Normally the animtaion's `end_cb` sets correct position of the roller is infinite.
     * But without animations do it manually*/
    if(anim_en == LV_ANIM_OFF || anim_time == 0) {
        inf_normalize(roller_scrl);
    }

    int32_t id = ext->ddlist.sel_opt_id;
    lv_coord_t line_y1 =
        id * (font_h + style_label->text.line_space) + ext->ddlist.label->coords.y1 - roller_scrl->coords.y1;
    lv_coord_t new_y = -line_y1 + (h - font_h) / 2;

    if(anim_en == LV_ANIM_OFF || anim_time == 0) {
        lv_obj_set_y(roller_scrl, new_y);
    } else {
#if LV_USE_ANIMATION
        lv_anim_t a;
        a.var            = roller_scrl;
        a.start          = lv_obj_get_y(roller_scrl);
        a.end            = new_y;
        a.exec_cb        = (lv_anim_exec_xcb_t)lv_obj_set_y;
        a.path_cb        = lv_anim_path_linear;
        a.ready_cb       = scroll_anim_ready_cb;
        a.act_time       = 0;
        a.time           = anim_time;
        a.playback       = 0;
        a.playback_pause = 0;
        a.repeat         = 0;
        a.repeat_pause   = 0;
        lv_anim_create(&a);
#endif
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %r15d
movq %rdi, %rbp
callq 0x2695e
movq %rax, %rbx
movq %rbp, %rdi
callq 0x6af7
movq %rax, %r14
movq 0x50(%rax), %rdi
callq 0x66b6
movq %rax, %r12
movq 0x28(%rax), %rax
movzbl 0x10(%rax), %r13d
movq %rbp, %rdi
callq 0x5697
movw %ax, 0xe(%rsp)
movq %rbp, %rdi
callq 0x26a3d
movl %eax, %ebp
testl %r15d, %r15d
sete %al
testw %bp, %bp
sete %r15b
orb %al, %r15b
cmpb $0x1, %r15b
jne 0xf53c
movq %rbx, %rdi
callq 0xf6fb
movq 0x50(%r14), %rax
movzwl 0x32(%r12), %ecx
addw %r13w, %cx
imulw 0x62(%r14), %cx
movswl 0xe(%rsp), %edx
subl %r13d, %edx
movl %edx, %r12d
shrl $0x1f, %r12d
addl %edx, %r12d
shrl %r12d
addw 0x22(%rax), %cx
subl %ecx, %r12d
addw 0x22(%rbx), %r12w
testb %r15b, %r15b
je 0xf590
movswl %r12w, %esi
movq %rbx, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5519
leaq 0x10(%rsp), %r14
movq %rbx, (%r14)
movq %rbx, %rdi
callq 0x4c15
cwtl
movl %eax, 0x20(%r14)
movswl %r12w, %eax
movl %eax, 0x24(%r14)
leaq -0xa09b(%rip), %rax     # 0x5519
movq %rax, 0x8(%r14)
leaq 0x1a5c9(%rip), %rax     # 0x29b88
movq %rax, 0x10(%r14)
leaq 0x1e6(%rip), %rax       # 0xf7b0
movq %rax, 0x18(%r14)
movw $0x0, 0x2a(%r14)
movw %bp, 0x28(%r14)
movl $0x0, 0x2c(%r14)
movb $0x0, 0x30(%r14)
movq %r14, %rdi
callq 0x29bb4
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq