// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_chart.c
// Function: lv_chart_set_next
void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y)
{
    LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
    LV_ASSERT_NULL(ser);

    lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
    if(ext->update_mode == LV_CHART_UPDATE_MODE_SHIFT) {
        ser->points[ser->start_point] =
            y; /*This was the place of the former left most value, after shifting it is the rightmost*/
        ser->start_point = (ser->start_point + 1) % ext->point_cnt;
        lv_chart_refresh(chart);
    } else if(ext->update_mode == LV_CHART_UPDATE_MODE_CIRCULAR) {
        ser->points[ser->start_point] = y;

        if(ext->type & LV_CHART_TYPE_LINE) lv_chart_inv_lines(chart, ser->start_point);
        if(ext->type & LV_CHART_TYPE_COLUMN) lv_chart_inv_cols(chart, ser->start_point);
        if(ext->type & LV_CHART_TYPE_POINT) lv_chart_inv_points(chart, ser->start_point);
        if(ext->type & LV_CHART_TYPE_VERTICAL_LINE) lv_chart_inv_lines(chart, ser->start_point);
        if(ext->type & LV_CHART_TYPE_AREA) lv_chart_inv_lines(chart, ser->start_point);

        ser->start_point = (ser->start_point + 1) % ext->point_cnt; /*update the x for next incoming y*/
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x7994
testb %al, %al
je 0x15554
movq %rbx, %rdi
callq 0x7994
testb %al, %al
je 0x15565
movq %r14, %rdi
callq 0x6747
movq %rax, %r15
movq (%rbx), %rax
movzwl 0xa(%rbx), %ecx
testb $0x1, 0x5a(%r15)
movw %bp, (%rax,%rcx,2)
jne 0x15576
movzwl 0xa(%rbx), %eax
incl %eax
movzwl 0x1e(%r15), %ecx
xorl %edx, %edx
divl %ecx
movw %dx, 0xa(%rbx)
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x150d4
leaq 0x25be9(%rip), %rdi     # 0x3b144
movq %r14, %rsi
callq 0x7b01
jmp 0x15563
leaq 0x25bd8(%rip), %rdi     # 0x3b144
movq %rbx, %rsi
callq 0x7b01
jmp 0x15574
movb 0x20(%r15), %al
testb $0x1, %al
je 0x1558e
movzwl 0xa(%rbx), %esi
movq %r14, %rdi
callq 0x156db
movb 0x20(%r15), %al
testb $0x2, %al
je 0x1561a
movzwl 0xa(%rbx), %ebp
movq %r14, %rdi
callq 0x6747
movq %rax, %r12
movq %r14, %rdi
callq 0x5308
movswl %ax, %ecx
movzbl 0x5e(%r12), %esi
incl %esi
movzwl 0x1e(%r12), %edi
imull %edi, %esi
movl %ecx, %eax
cltd
idivl %esi
movl %eax, %r12d
cwtd
movw $0x2, %si
idivw %si
movzwl %ax, %esi
imull %ecx, %ebp
movl %ebp, %eax
cltd
idivl %edi
movzwl 0x20(%r14), %ebp
addl %eax, %ebp
addl %esi, %ebp
leaq 0x10(%rsp), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x50e5
movw %bp, (%r13)
addl %r12d, %ebp
movw %bp, 0x4(%r13)
movq %r14, %rdi
callq 0x4d17
movq %rax, %rdi
movq %r13, %rsi
callq 0x6cff
movb 0x20(%r15), %al
testb $0x4, %al
je 0x15695
movzwl 0xa(%rbx), %r12d
movq %r14, %rdi
callq 0x6747
movq %rax, %r13
movq %r14, %rdi
callq 0x5308
movl %eax, %ebp
movzwl 0x20(%r14), %eax
movw %ax, 0xe(%rsp)
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x50e5
movswl %bp, %eax
imull %r12d, %eax
movzwl 0x1e(%r13), %ecx
decl %ecx
cltd
idivl %ecx
addw 0xe(%rsp), %ax
movl 0x5c(%r13), %ecx
leal (%rax,%rcx), %edx
leaq 0x10(%rsp), %r12
movw %dx, 0x4(%r12)
subl %ecx, %eax
movw %ax, (%r12)
movq %r14, %rdi
callq 0x4d17
movq %rax, %rdi
movq %r12, %rsi
callq 0x6cff
movb 0x20(%r15), %al
testb $0x8, %al
je 0x156a9
movzwl 0xa(%rbx), %esi
movq %r14, %rdi
callq 0x156db
movb 0x20(%r15), %al
testb $0x10, %al
je 0x156b9
movzwl 0xa(%rbx), %esi
movq %r14, %rdi
callq 0x156db
movzwl 0xa(%rbx), %eax
incl %eax
movzwl 0x1e(%r15), %ecx
xorl %edx, %edx
divl %ecx
movw %dx, 0xa(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq