// File: /workspace/github_c_makefile_star2_O1/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 0x1d9ac
movq %rax, %rbx
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x20563
testq %rbx, %rbx
je 0x20574
movq %rbx, %rdi
movl $0xb8, %esi
callq 0x64bc
movq %rax, %r15
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x20578
testq %r15, %r15
je 0x20574
cmpq $0x0, 0x3ffbe(%rip)     # 0x60410
jne 0x20463
movq %rbx, %rdi
callq 0x6a6c
movq %rax, 0x3ffad(%rip)     # 0x60410
cmpq $0x0, 0x3ffad(%rip)     # 0x60418
jne 0x2047c
movq %rbx, %rdi
callq 0x6a90
movq %rax, 0x3ff9c(%rip)     # 0x60418
movabsq $0x1869f00000000, %rax  # imm = 0x1869F00000000
movq %rax, 0xa0(%r15)
movl $0xfffff000, %eax       # imm = 0xFFFFF000
andl 0xb0(%r15), %eax
orl $0x5, %eax
movw %ax, 0xb0(%r15)
movabsq $0x1fffe7961, %rax      # imm = 0x1FFFE7961
movq %rax, 0xa8(%r15)
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1fad3
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1e605
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1fb32
leaq 0x100(%rip), %rsi       # 0x205e0
movq %rbx, %rdi
callq 0x645c
movq 0x3ff29(%rip), %rsi     # 0x60418
movq %rbx, %rdi
callq 0x648c
testq %r14, %r14
je 0x20589
movq %r14, %rdi
callq 0x6ad8
movq %rax, %r14
movl 0xa0(%rax), %esi
movq %rbx, %rdi
callq 0x20743
movzwl 0xb0(%r14), %esi
movl %esi, %eax
shrb $0x4, %al
andl $0xf, %esi
movzbl %al, %edx
movq %rbx, %rdi
callq 0x207a3
movl 0xa4(%r14), %edx
movl 0xa8(%r14), %esi
movq %rbx, %rdi
callq 0x2080f
movl 0xac(%r14), %esi
movq %rbx, %rdi
callq 0x208a0
movq %rbx, %rdi
callq 0x5e38
jmp 0x205cf
leaq 0x1ead6(%rip), %rdi     # 0x3f040
movq %rbx, %rsi
callq 0x829e
jmp 0x20572
xorl %ebx, %ebx
jmp 0x205d7
leaq 0x1eac1(%rip), %rdi     # 0x3f040
movq %r15, %rsi
callq 0x829e
jmp 0x20587
callq 0x2e244
testq %rax, %rax
je 0x205cf
movq %rax, %r14
movq 0x240(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1e4f8
movq 0x248(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1e4f8
movq 0x250(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1e4f8
movq %rbx, %rdi
callq 0x208de
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq