// File: /workspace/github_c_makefile_star2_O2/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 0x245d9
movq %rax, %rbx
movq %rbp, %rdi
callq 0x6747
movq %rax, %r14
movq 0x50(%rax), %rdi
callq 0x6316
movq %rax, %r12
movq 0x28(%rax), %rax
movzbl 0x10(%rax), %r13d
movq %rbp, %rdi
callq 0x5332
movw %ax, 0xe(%rsp)
movq %rbp, %rdi
callq 0x246b8
movl %eax, %ebp
testl %r15d, %r15d
sete %al
testw %bp, %bp
sete %r15b
orb %al, %r15b
cmpb $0x1, %r15b
jne 0xea34
movq %rbx, %rdi
callq 0xebe9
movq 0x50(%r14), %rcx
movzwl 0x32(%r12), %esi
addw %r13w, %si
imulw 0x62(%r14), %si
movswl 0xe(%rsp), %eax
subl %r13d, %eax
pushq $0x2
popq %rdi
cltd
idivl %edi
movl %eax, %r14d
addw 0x22(%rcx), %si
subl %esi, %r14d
addw 0x22(%rbx), %r14w
testb %r15b, %r15b
je 0xea84
movswl %r14w, %esi
movq %rbx, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x51d0
leaq 0x10(%rsp), %r15
movq %rbx, (%r15)
movq %rbx, %rdi
callq 0x4902
cwtl
movl %eax, 0x20(%r15)
movswl %r14w, %eax
movl %eax, 0x24(%r15)
leaq -0x98d8(%rip), %rax     # 0x51d0
movq %rax, 0x8(%r15)
leaq 0x18ba6(%rip), %rax     # 0x27659
movq %rax, 0x10(%r15)
leaq 0x1d3(%rip), %rax       # 0xec91
movq %rax, 0x18(%r15)
andw $0x0, 0x2a(%r15)
movw %bp, 0x28(%r15)
andl $0x0, 0x2c(%r15)
movb $0x0, 0x30(%r15)
movq %r15, %rdi
callq 0x27685
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq