// File: /workspace/github_c_makefile_star2_O1/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 0x80d4
testb %al, %al
je 0xf34e
movq %r14, %rdi
callq 0x80d4
testb %al, %al
je 0xf35f
movq %rbx, %rdi
callq 0x6ad8
movb 0x70(%rax), %cl
testb %bpl, %bpl
je 0xf370
orb $0x1, %cl
movq %rax, 0x10(%rsp)
movb %cl, 0x70(%rax)
movq %r14, %rdi
callq 0x2070
movq %rax, %r13
leaq 0x8(,%rax,8), %rdi
movq %rax, %r12
incq %r12
subq %r12, %rdi
movq %rdi, 0x8(%rsp)
callq 0x298d9
movq %rax, %rbp
movl $0x7, %r15d
movq %rax, (%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2040
movb $0xa, (%rbp,%r13)
addq %r12, %rbp
decq %r15
jne 0xf2d5
movq 0x8(%rsp), %rax
movq (%rsp), %r14
movb $0x0, -0x1(%r14,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xbdc0
movq %r14, %rdi
callq 0x29984
movq %rbx, %rdi
callq 0xf394
movq 0x10(%rsp), %rax
movzwl 0x60(%rax), %eax
imull $0x2493, %eax, %ecx     # imm = 0x2493
shrl $0x10, %ecx
subl %ecx, %eax
movzwl %ax, %esi
shrl %esi
addl %ecx, %esi
andl $-0x4, %esi
movq %rbx, %rdi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf439
leaq 0x2fddf(%rip), %rdi     # 0x3f134
movq %rbx, %rsi
callq 0x829e
jmp 0xf35d
leaq 0x2fdce(%rip), %rdi     # 0x3f134
movq %r14, %rsi
callq 0x829e
jmp 0xf36e
andb $-0x2, %cl
movb %cl, 0x70(%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xbdc0
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf394