// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_roller.c
// Function: lv_roller_set_options
void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mode_t mode)
{
    LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
    LV_ASSERT_STR(options);

    lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);

    if(mode == LV_ROLLER_MODE_NORMAL) {
        ext->mode = LV_ROLLER_MODE_NORMAL;
        lv_ddlist_set_options(roller, options);

        /* Make sure the roller's height and the scrollable's height is refreshed.
         * They are refreshed in `LV_SIGNAL_COORD_CHG` but if the new options has the same width
         * that signal won't be called. (It called because LV_FIT_TIGHT hor fit)*/
        refr_height(roller);
    } else {
        ext->mode = LV_ROLLER_MODE_INIFINITE;

        size_t opt_len = strlen(options) + 1; /*+1 to add '\n' after option lists*/
        char * opt_extra = lv_mem_alloc(opt_len * LV_ROLLER_INF_PAGES);
        uint8_t i;
        for(i = 0; i < LV_ROLLER_INF_PAGES; i++) {
            strcpy(&opt_extra[opt_len * i], options);
            opt_extra[opt_len * (i + 1) - 1] = '\n';
        }
        opt_extra[opt_len * LV_ROLLER_INF_PAGES - 1] = '\0';
        lv_ddlist_set_options(roller, opt_extra);
        lv_mem_free(opt_extra);

        /* Make sure the roller's height and the scrollable's height is refreshed.
         * They are refreshed in `LV_SIGNAL_COORD_CHG` but if the new options has the same width
         * that signal won't be called. (It called because LV_FIT_TIGHT hor fit)*/
        refr_height(roller);

        uint16_t real_id_cnt = ext->ddlist.option_cnt / LV_ROLLER_INF_PAGES;
        lv_roller_set_selected(roller, ((LV_ROLLER_INF_PAGES / 2) + 1) * real_id_cnt, false); /*Select the middle page*/
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
callq 0x7994
testb %al, %al
je 0xe752
movq %r14, %rdi
callq 0x7994
testb %al, %al
je 0xe763
movq %rbx, %rdi
callq 0x6747
movb 0x70(%rax), %cl
testb %bpl, %bpl
je 0xe7ce
orb $0x1, %cl
movq %rax, 0x10(%rsp)
movb %cl, 0x70(%rax)
movq %r14, %rdi
callq 0x2070
movq %rax, %r15
movq %rax, %r12
incq %r12
imulq $0x7, %r12, %rdi
movq %rdi, (%rsp)
callq 0x279f9
movq %rax, %r13
pushq $0x7
popq %rbp
movq %rax, 0x8(%rsp)
subq $0x1, %rbp
jb 0xe774
movq %r13, %rdi
movq %r14, %rsi
callq 0x2040
movb $0xa, (%r13,%r15)
addq %r12, %r13
jmp 0xe736
leaq 0x2c9eb(%rip), %rdi     # 0x3b144
movq %rbx, %rsi
callq 0x7b01
jmp 0xe761
leaq 0x2c9da(%rip), %rdi     # 0x3b144
movq %r14, %rsi
callq 0x7b01
jmp 0xe772
movq 0x8(%rsp), %r14
movq (%rsp), %rax
movb $0x0, -0x1(%r14,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb376
movq %r14, %rdi
callq 0x27a7a
movq %rbx, %rdi
callq 0xe7f2
movq 0x10(%rsp), %rax
movzwl 0x60(%rax), %eax
movw $0x7, %cx
xorl %edx, %edx
divw %cx
shll $0x2, %eax
movzwl %ax, %esi
movq %rbx, %rdi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe897
andb $-0x2, %cl
movb %cl, 0x70(%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb376
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe7f2