// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_spinbox.c
// Function: lv_spinbox_create
lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("spinbox create started");

    /*Create the ancestor of spinbox*/
    lv_obj_t * new_spinbox = lv_ta_create(par, copy);
    LV_ASSERT_MEM(new_spinbox);
    if(new_spinbox == NULL) return NULL;

    /*Allocate the spinbox type specific extended data*/
    lv_spinbox_ext_t * ext = lv_obj_allocate_ext_attr(new_spinbox, sizeof(lv_spinbox_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;
    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_spinbox);
    if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_spinbox);

    /*Initialize the allocated 'ext'*/
    ext->value              = 0;
    ext->dec_point_pos      = 0;
    ext->digit_count        = 5;
    ext->digit_padding_left = 0;
    ext->step               = 1;
    ext->range_max          = 99999;
    ext->range_min          = -99999;

    lv_ta_set_cursor_type(new_spinbox, LV_CURSOR_BLOCK);
    lv_ta_set_one_line(new_spinbox, true);
    lv_ta_set_cursor_click_pos(new_spinbox, false);

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_spinbox, lv_spinbox_signal);
    lv_obj_set_design_cb(new_spinbox, ancestor_design); /*Leave the Text area's design function*/

    /*Init the new spinbox spinbox*/
    if(copy == NULL) {
        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_spinbox_set_style(new_spinbox, LV_SPINBOX_STYLE_BG, th->style.spinbox.bg);
            lv_spinbox_set_style(new_spinbox, LV_SPINBOX_STYLE_CURSOR, th->style.spinbox.cursor);
            lv_spinbox_set_style(new_spinbox, LV_SPINBOX_STYLE_SB, th->style.spinbox.sb);
        }
    }
    /*Copy an existing spinbox*/
    else {
        lv_spinbox_ext_t * copy_ext = lv_obj_get_ext_attr(copy);

        lv_spinbox_set_value(new_spinbox, copy_ext->value);
        lv_spinbox_set_digit_format(new_spinbox, (uint8_t)copy_ext->digit_count, (uint8_t)copy_ext->dec_point_pos);
        lv_spinbox_set_range(new_spinbox, copy_ext->range_min, copy_ext->range_max);
        lv_spinbox_set_step(new_spinbox, copy_ext->step);

        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_spinbox);
    }

    lv_spinbox_updatevalue(new_spinbox);

    LV_LOG_INFO("spinbox created");

    return new_spinbox;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
callq 0x1c300
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x1ed28
testq %rbx, %rbx
je 0x1ed39
movq %rbx, %rdi
movl $0xb8, %esi
callq 0x6146
movq %rax, %r15
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x1ed3d
testq %r15, %r15
je 0x1ed39
cmpq $0x0, 0x3f7e2(%rip)     # 0x5e410
jne 0x1ec3f
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x3f7d1(%rip)     # 0x5e410
cmpq $0x0, 0x3f7d1(%rip)     # 0x5e418
jne 0x1ec58
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x3f7c0(%rip)     # 0x5e418
movl $0xfffff000, %eax       # imm = 0xFFFFF000
andl 0xb0(%r15), %eax
orl $0x5, %eax
movw %ax, 0xb0(%r15)
movaps 0x1ccaa(%rip), %xmm0    # 0x3b920
movups %xmm0, 0xa0(%r15)
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1e2f4
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1cf26
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1e353
leaq 0xfc(%rip), %rsi        # 0x1eda1
movq %rbx, %rdi
callq 0x60e6
movq 0x3f764(%rip), %rsi     # 0x5e418
movq %rbx, %rdi
callq 0x6116
testq %r14, %r14
je 0x1ed4e
movq %r14, %rdi
callq 0x6747
movq %rax, %r14
movl 0xa0(%rax), %esi
movq %rbx, %rdi
callq 0x1eeff
movzwl 0xb0(%r14), %esi
movl %esi, %eax
shrb $0x4, %al
andl $0xf, %esi
movzbl %al, %edx
movq %rbx, %rdi
callq 0x1ef5f
movl 0xa4(%r14), %edx
movl 0xa8(%r14), %esi
movq %rbx, %rdi
callq 0x1efc9
movl 0xac(%r14), %esi
movq %rbx, %rdi
callq 0x1f05f
movq %rbx, %rdi
callq 0x5ae7
jmp 0x1ed90
leaq 0x1c311(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0x1ed37
xorl %ebx, %ebx
jmp 0x1ed98
leaq 0x1c2fc(%rip), %rdi     # 0x3b040
movq %r15, %rsi
callq 0x7b01
jmp 0x1ed4c
callq 0x2be75
testq %rax, %rax
je 0x1ed90
movq %rax, %r14
movq 0x240(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1ce17
movq 0x248(%r14), %rdx
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1ce17
movq 0x250(%r14), %rdx
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1ce17
movq %rbx, %rdi
callq 0x1f09d
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq