// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_spinbox.c
// Function: lv_spinbox_updatevalue
static void lv_spinbox_updatevalue(lv_obj_t * spinbox)
{
    lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);

    char buf[LV_SPINBOX_MAX_DIGIT_COUNT + 8];
    memset(buf, 0, sizeof(buf));
    char * buf_p = buf;

    if (ext->range_min < 0) { // hide sign if there are only positive values
        /*Add the sign*/
        (*buf_p) = ext->value >= 0 ? '+' : '-';
        buf_p++;
    }

    int32_t i;
    /*padding left*/
    for(i = 0; i < ext->digit_padding_left; i++) {
        (*buf_p) = ' ';
        buf_p++;
    }

    char digits[64];
    /*Convert the numbers to string (the sign is already handled so always covert positive number)*/
    lv_utils_num_to_str(ext->value < 0 ? -ext->value : ext->value, digits);

    /*Add leading zeros*/
    int lz_cnt = ext->digit_count - (int)strlen(digits);
    if(lz_cnt > 0) {
        for(i = (uint16_t)strlen(digits); i >= 0; i--) {
            digits[i + lz_cnt] = digits[i];
        }
        for(i = 0; i < lz_cnt; i++) {
            digits[i] = '0';
        }
    }

    int32_t intDigits;
    intDigits = (ext->dec_point_pos == 0) ? ext->digit_count : ext->dec_point_pos;

    /*Add the decimal part*/
    for(i = 0; i < intDigits && digits[i] != '\0'; i++) {
        (*buf_p) = digits[i];
        buf_p++;
    }

    if(ext->dec_point_pos != 0) {
        /*Insert the decimal point*/
        (*buf_p) = '.';
        buf_p++;

        for(/*Leave i*/; i < ext->digit_count && digits[i] != '\0'; i++) {
            (*buf_p) = digits[i];
            buf_p++;
        }
    }

    /*Refresh the text*/
    lv_ta_set_text(spinbox, (char *)buf);

    /*Set the cursor position*/
    int32_t step    = ext->step;
    uint8_t cur_pos = (uint8_t)ext->digit_count;
    while(step >= 10) {
        step /= 10;
        cur_pos--;
    }

    if(cur_pos > intDigits) cur_pos++; /*Skip teh decimal point*/

    cur_pos += ext->digit_padding_left;

    lv_ta_set_cursor_pos(spinbox, cur_pos);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2090
leaq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xa8(%rax)
jge 0x3523f
movq -0x10(%rbp), %rax
movl 0xa0(%rax), %edx
movl $0x2d, %eax
movl $0x2b, %ecx
cmpl $0x0, %edx
cmovgel %ecx, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x10(%rbp), %rcx
movw 0xb0(%rcx), %cx
shrw $0x8, %cx
andw $0xf, %cx
movzwl %cx, %ecx
cmpl %ecx, %eax
jge 0x35281
movq -0x38(%rbp), %rax
movb $0x20, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x35246
movq -0x10(%rbp), %rax
cmpl $0x0, 0xa0(%rax)
jge 0x352a2
movq -0x10(%rbp), %rcx
xorl %eax, %eax
subl 0xa0(%rcx), %eax
movl %eax, -0x94(%rbp)
jmp 0x352b2
movq -0x10(%rbp), %rax
movl 0xa0(%rax), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %edi
leaq -0x80(%rbp), %rsi
callq 0x475d0
movq -0x10(%rbp), %rax
movw 0xb0(%rax), %ax
andw $0xf, %ax
movzwl %ax, %eax
movl %eax, -0x98(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x2060
movq %rax, %rcx
movl -0x98(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
jle 0x3535b
leaq -0x80(%rbp), %rdi
callq 0x2060
movzwl %ax, %eax
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jl 0x35333
movslq -0x3c(%rbp), %rax
movb -0x80(%rbp,%rax), %cl
movl -0x3c(%rbp), %eax
addl -0x84(%rbp), %eax
cltq
movb %cl, -0x80(%rbp,%rax)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3530b
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x84(%rbp), %eax
jge 0x35359
movslq -0x3c(%rbp), %rax
movb $0x30, -0x80(%rbp,%rax)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3533a
jmp 0x3535b
movq -0x10(%rbp), %rax
movw 0xb0(%rax), %ax
shrw $0x4, %ax
andw $0xf, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x35390
movq -0x10(%rbp), %rax
movw 0xb0(%rax), %ax
andw $0xf, %ax
movzwl %ax, %eax
movl %eax, -0x9c(%rbp)
jmp 0x353ac
movq -0x10(%rbp), %rax
movw 0xb0(%rax), %ax
shrw $0x4, %ax
andw $0xf, %ax
movzwl %ax, %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x88(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x88(%rbp), %ecx
movb %al, -0x9d(%rbp)
jge 0x353e7
movslq -0x3c(%rbp), %rax
movsbl -0x80(%rbp,%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x9d(%rbp)
movb -0x9d(%rbp), %al
testb $0x1, %al
jne 0x353f3
jmp 0x35418
movslq -0x3c(%rbp), %rax
movb -0x80(%rbp,%rax), %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x353bf
movq -0x10(%rbp), %rax
movw 0xb0(%rax), %ax
shrw $0x4, %ax
andw $0xf, %ax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x354af
movq -0x38(%rbp), %rax
movb $0x2e, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rax
movw 0xb0(%rax), %ax
andw $0xf, %ax
movzwl %ax, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x9e(%rbp)
jge 0x3547c
movslq -0x3c(%rbp), %rax
movsbl -0x80(%rbp,%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x9e(%rbp)
movb -0x9e(%rbp), %al
testb $0x1, %al
jne 0x35488
jmp 0x354ad
movslq -0x3c(%rbp), %rax
movb -0x80(%rbp,%rax), %cl
movq -0x38(%rbp), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x35446
jmp 0x354af
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x32f80
movq -0x10(%rbp), %rax
movl 0xac(%rax), %eax
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rax
movw 0xb0(%rax), %ax
andw $0xf, %ax
movb %al, -0x8d(%rbp)
cmpl $0xa, -0x8c(%rbp)
jl 0x3550e
movl -0x8c(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, -0x8c(%rbp)
movb -0x8d(%rbp), %al
addb $-0x1, %al
movb %al, -0x8d(%rbp)
jmp 0x354e1
movzbl -0x8d(%rbp), %eax
cmpl -0x88(%rbp), %eax
jle 0x3552b
movb -0x8d(%rbp), %al
addb $0x1, %al
movb %al, -0x8d(%rbp)
movq -0x10(%rbp), %rax
movw 0xb0(%rax), %ax
shrw $0x8, %ax
andw $0xf, %ax
movzwl %ax, %ecx
movzbl -0x8d(%rbp), %eax
addl %ecx, %eax
movb %al, -0x8d(%rbp)
movq -0x8(%rbp), %rdi
movzbl -0x8d(%rbp), %eax
movswl %ax, %esi
callq 0x32770
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)