// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_chart.c
// Function: lv_chart_get_next_label
static void lv_chart_get_next_label(lv_chart_label_iterator_t * iterator, char * buf)
{
    uint8_t label_len = 0;
    if (iterator->is_reverse_iter) {
        const char * label_start;
        /* count the length of the current label*/
        while ((*iterator->current_pos != '\n') &&
                (iterator->current_pos != iterator->list_start)) {
            iterator->current_pos--;
            label_len++;
        }

        label_start = iterator->current_pos;

        if (*iterator->current_pos == '\n') {
            /* do not copy \n symbol, +1 to skip it*/
            label_start++;
            /* skip newline*/
            iterator->current_pos--;
        } else {
            /* it is last label in list (first one from the beginning )*/
            label_len++;
        }

        /* do not allow output buffer overflow */
        if (label_len > LV_CHART_AXIS_TICK_LABEL_MAX_LEN) {
            label_len = LV_CHART_AXIS_TICK_LABEL_MAX_LEN;
        }

        strncpy(buf, label_start, label_len);
    } else {
        /* search for tick string */
        while(iterator->current_pos[label_len] != '\n' &&
            iterator->current_pos[label_len] != '\0') {
            /* do not overflow the buffer, but move to the end of the current label */
            if(label_len < LV_CHART_AXIS_TICK_LABEL_MAX_LEN) {
                buf[label_len] = iterator->current_pos[label_len];
                label_len++;
            } else {
                label_len++;
            }
        }

        iterator->current_pos += label_len;

        /* do not allow output buffer overflow */
        if (label_len > LV_CHART_AXIS_TICK_LABEL_MAX_LEN) {
            label_len = LV_CHART_AXIS_TICK_LABEL_MAX_LEN;
        }

        if(*iterator->current_pos == '\n') iterator->current_pos++;
    }

    /* terminate the string */
    buf[label_len] = '\0';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x11(%rax)
je 0x26628
jmp 0x26574
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x21(%rbp)
je 0x2659e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x265a7
jmp 0x265c1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0x26574
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x265fb
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x26603
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x14, %eax
jle 0x26610
movb $0x14, -0x11(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movzbl -0x11(%rbp), %eax
movl %eax, %edx
callq 0x2030
jmp 0x266e2
jmp 0x2662a
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movzbl -0x11(%rbp), %ecx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x22(%rbp)
je 0x2665d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movzbl -0x11(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x22(%rbp)
movb -0x22(%rbp), %al
testb $0x1, %al
jne 0x26666
jmp 0x2669d
movzbl -0x11(%rbp), %eax
cmpl $0x14, %eax
jge 0x26693
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movzbl -0x11(%rbp), %ecx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movzbl -0x11(%rbp), %ecx
movb %dl, (%rax,%rcx)
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0x2669b
movb -0x11(%rbp), %al
addb $0x1, %al
movb %al, -0x11(%rbp)
jmp 0x2662a
movzbl -0x11(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
movzbl -0x11(%rbp), %eax
cmpl $0x14, %eax
jle 0x266c0
movb $0x14, -0x11(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x266e0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x266e2
movq -0x10(%rbp), %rax
movzbl -0x11(%rbp), %ecx
movb $0x0, (%rax,%rcx)
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop