// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_chart.c
// Function: lv_chart_draw_y_ticks
static void lv_chart_draw_y_ticks(lv_obj_t * chart, const lv_area_t * mask, uint8_t which_axis)
{
    lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
    lv_chart_axis_cfg_t * y_axis = (which_axis == LV_CHART_AXIS_PRIMARY_Y) ?
                                            &ext->y_axis : &ext->secondary_y_axis;

    if(y_axis->list_of_values != NULL || y_axis->num_tick_marks != 0) {

        const lv_style_t * style = lv_obj_get_style(chart);
        lv_opa_t opa_scale       = lv_obj_get_opa_scale(chart);

        uint8_t i;
        uint8_t num_of_labels;
        uint8_t num_scale_ticks;
        int8_t major_tick_len, minor_tick_len;
        uint8_t iter_dir;

        lv_point_t p1;
        lv_point_t p2;
        lv_coord_t x_ofs;
        lv_chart_label_iterator_t iter;
        lv_coord_t y_ofs = chart->coords.y1;
        lv_coord_t h     = lv_obj_get_height(chart);
        lv_coord_t w     = lv_obj_get_width(chart);
        char buf[LV_CHART_AXIS_TICK_LABEL_MAX_LEN + 1]; /* up to N symbols per label + null terminator */

        /* chose correct side of the chart */
        if(which_axis == LV_CHART_AXIS_PRIMARY_Y)
            x_ofs = chart->coords.x1;
        else
            x_ofs = chart->coords.x2;

        /* calculate the size of tick marks */
        if(y_axis->major_tick_len == LV_CHART_TICK_LENGTH_AUTO)
            major_tick_len = (int32_t)w * LV_CHART_AXIS_MAJOR_TICK_LEN_COE;
        else
            major_tick_len = y_axis->major_tick_len;

        if(y_axis->minor_tick_len == LV_CHART_TICK_LENGTH_AUTO)
            minor_tick_len = major_tick_len * LV_CHART_AXIS_MINOR_TICK_LEN_COE;
        else
            minor_tick_len = y_axis->minor_tick_len;

        /* tick lines on secondary y axis are drawn in other direction*/
        if(which_axis == LV_CHART_AXIS_SECONDARY_Y) {
            major_tick_len *= -1;
            minor_tick_len *= -1;
        }

        iter_dir = (y_axis->options & LV_CHART_AXIS_INVERSE_LABELS_ORDER) ? LV_CHART_LABEL_ITERATOR_REVERSE : LV_CHART_LABEL_ITERATOR_FORWARD;
        iter = lv_chart_create_label_iter(y_axis->list_of_values, iter_dir);

        /*determine the number of options */
        num_of_labels = iter.items_left;

        /* we can't have string labels without ticks step, set to 1 if not specified */
        if(y_axis->num_tick_marks == 0) y_axis->num_tick_marks = 1;

        /* calculate total number of ticks */
        if(num_of_labels < 2)
            num_scale_ticks = y_axis->num_tick_marks;
        else
            num_scale_ticks = (y_axis->num_tick_marks * (num_of_labels - 1));

        for(i = 0; i < (num_scale_ticks + 1); i++) { /* one extra loop - it may not exist in the list, empty label */
                                                     /* first point of the tick */
            p1.x = x_ofs;

            /* move extra pixel out of chart boundary */
            if (which_axis == LV_CHART_AXIS_PRIMARY_Y)
                p1.x--;
            else
                p1.x++;

            /* second point of the tick */
            if((num_of_labels != 0) && (i == 0 || i % y_axis->num_tick_marks == 0))
                p2.x = p1.x - major_tick_len; /* major tick */
            else
                p2.x = p1.x - minor_tick_len; /* minor tick */

            /* draw a line at moving y position */
            p2.y = p1.y =
                y_ofs + (int32_t)((int32_t)(h - style->line.width) * i) / num_scale_ticks;

            if(y_axis->options & LV_CHART_AXIS_INVERSE_LABELS_ORDER) {
                /*if label order is inversed last tick have number 0*/
                if(i != 0)
                    lv_draw_line(&p1, &p2, mask, style, opa_scale);
                else if((y_axis->options & LV_CHART_AXIS_DRAW_LAST_TICK) != 0)
                    lv_draw_line(&p1, &p2, mask, style, opa_scale);
            } else {
                if(i != num_scale_ticks)
                    lv_draw_line(&p1, &p2, mask, style, opa_scale);
                else if((y_axis->options & LV_CHART_AXIS_DRAW_LAST_TICK) != 0)
                    lv_draw_line(&p1, &p2, mask, style, opa_scale);
            }

            /* draw values if available */
            if(num_of_labels != 0) {
                /* add text only to major tick */
                if(lv_chart_is_tick_with_label(i, y_axis)) {

                    lv_chart_get_next_label(&iter, buf);

                    /* reserve appropriate area */
                    lv_point_t size;
                    lv_txt_get_size(&size, buf, style->text.font, style->text.letter_space, style->text.line_space,
                                    LV_COORD_MAX, LV_TXT_FLAG_CENTER);

                    /* set the area at some distance of the major tick len left of the tick */
                    lv_area_t a = {.y1 = p2.y - size.y / 2, .y2 = p2.y + size.y / 2};

                    if(which_axis == LV_CHART_AXIS_PRIMARY_Y) {
                        a.x1 = p2.x - size.x - LV_CHART_AXIS_TO_LABEL_DISTANCE;
                        a.x2 = p2.x - LV_CHART_AXIS_TO_LABEL_DISTANCE;
                    } else {
                        a.x1 = p2.x + LV_CHART_AXIS_TO_LABEL_DISTANCE;
                        a.x2 = p2.x + size.x + LV_CHART_AXIS_TO_LABEL_DISTANCE;
                    }

                    lv_draw_label(&a, mask, style, opa_scale, buf, LV_TXT_FLAG_CENTER, NULL, NULL, NULL, lv_obj_get_base_dir(chart));
                }
            }

        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x20(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x1, %eax
jne 0x25b6f
movq -0x20(%rbp), %rax
addq $0x28, %rax
movq %rax, -0xb0(%rbp)
jmp 0x25b7e
movq -0x20(%rbp), %rax
addq $0x48, %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x25ba4
movq -0x28(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x0, %eax
je 0x2604b
movq -0x8(%rbp), %rdi
callq 0xa080
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa710
movb %al, -0x31(%rbp)
movq -0x8(%rbp), %rax
movw 0x22(%rax), %ax
movw %ax, -0x62(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8350
movw %ax, -0x64(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8310
movw %ax, -0x66(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x1, %eax
jne 0x25bfa
movq -0x8(%rbp), %rax
movw 0x20(%rax), %ax
movw %ax, -0x42(%rbp)
jmp 0x25c06
movq -0x8(%rbp), %rax
movw 0x24(%rax), %ax
movw %ax, -0x42(%rbp)
movq -0x28(%rbp), %rax
movzbl 0xa(%rax), %eax
cmpl $0xff, %eax
jne 0x25c29
movswl -0x66(%rbp), %eax
shll $0x0, %eax
movl $0xf, %ecx
cltd
idivl %ecx
movb %al, -0x35(%rbp)
jmp 0x25c33
movq -0x28(%rbp), %rax
movb 0xa(%rax), %al
movb %al, -0x35(%rbp)
movq -0x28(%rbp), %rax
movzbl 0xb(%rax), %eax
cmpl $0xff, %eax
jne 0x25c55
movsbl -0x35(%rbp), %eax
shll %eax
movl $0x3, %ecx
cltd
idivl %ecx
movb %al, -0x36(%rbp)
jmp 0x25c5f
movq -0x28(%rbp), %rax
movb 0xb(%rax), %al
movb %al, -0x36(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
jne 0x25c7c
movsbl -0x35(%rbp), %eax
imull $-0x1, %eax, %eax
movb %al, -0x35(%rbp)
movsbl -0x36(%rbp), %eax
imull $-0x1, %eax, %eax
movb %al, -0x36(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x8(%rax), %edx
andl $0x2, %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, -0x37(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rsi
leaq -0x98(%rbp), %rdi
movzbl -0x37(%rbp), %edx
callq 0x26440
movq -0x98(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x50(%rbp)
movb -0x50(%rbp), %al
movb %al, -0x33(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x9(%rax), %eax
cmpl $0x0, %eax
jne 0x25cea
movq -0x28(%rbp), %rax
movb $0x1, 0x9(%rax)
movzbl -0x33(%rbp), %eax
cmpl $0x2, %eax
jge 0x25cff
movq -0x28(%rbp), %rax
movb 0x9(%rax), %al
movb %al, -0x34(%rbp)
jmp 0x25d14
movq -0x28(%rbp), %rax
movzbl 0x9(%rax), %eax
movzbl -0x33(%rbp), %ecx
subl $0x1, %ecx
imull %ecx, %eax
movb %al, -0x34(%rbp)
movb $0x0, -0x32(%rbp)
movzbl -0x32(%rbp), %eax
movzbl -0x34(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0x26049
movw -0x42(%rbp), %ax
movw %ax, -0x3c(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x1, %eax
jne 0x25d4a
movw -0x3c(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x3c(%rbp)
jmp 0x25d56
movw -0x3c(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x3c(%rbp)
movzbl -0x33(%rbp), %eax
cmpl $0x0, %eax
je 0x25d8c
movzbl -0x32(%rbp), %eax
cmpl $0x0, %eax
je 0x25d7c
movzbl -0x32(%rbp), %eax
movq -0x28(%rbp), %rcx
movzbl 0x9(%rcx), %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x25d8c
movswl -0x3c(%rbp), %eax
movsbl -0x35(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x40(%rbp)
jmp 0x25d9a
movswl -0x3c(%rbp), %eax
movsbl -0x36(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x40(%rbp)
movswl -0x62(%rbp), %eax
movl %eax, -0xb4(%rbp)
movswl -0x64(%rbp), %eax
movq -0x30(%rbp), %rcx
movswl 0x3e(%rcx), %ecx
subl %ecx, %eax
movzbl -0x32(%rbp), %ecx
imull %ecx, %eax
movzbl -0x34(%rbp), %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xb4(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x3a(%rbp)
movw %ax, -0x3e(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x8(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x25e35
movzbl -0x32(%rbp), %eax
cmpl $0x0, %eax
je 0x25e07
movq -0x10(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movzbl -0x31(%rbp), %r8d
callq 0x5fcd0
jmp 0x25e33
movq -0x28(%rbp), %rax
movzbl 0x8(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x25e31
movq -0x10(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movzbl -0x31(%rbp), %r8d
callq 0x5fcd0
jmp 0x25e33
jmp 0x25e8b
movzbl -0x32(%rbp), %eax
movzbl -0x34(%rbp), %ecx
cmpl %ecx, %eax
je 0x25e5d
movq -0x10(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movzbl -0x31(%rbp), %r8d
callq 0x5fcd0
jmp 0x25e89
movq -0x28(%rbp), %rax
movzbl 0x8(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x25e87
movq -0x10(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movzbl -0x31(%rbp), %r8d
callq 0x5fcd0
jmp 0x25e89
jmp 0x25e8b
movzbl -0x33(%rbp), %eax
cmpl $0x0, %eax
je 0x2603a
movb -0x32(%rbp), %al
movq -0x28(%rbp), %rsi
movzbl %al, %edi
callq 0x26510
testb $0x1, %al
jne 0x25eb0
jmp 0x26038
leaq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x26550
leaq -0x80(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x30(%rbp), %rax
movw 0x30(%rax), %cx
movq -0x30(%rbp), %rax
leaq -0x9c(%rbp), %rdi
movl $0x7c18, %r9d           # imm = 0x7C18
movswl %cx, %ecx
movswl 0x32(%rax), %r8d
movl $0x4, (%rsp)
callq 0x46820
movw $0x0, -0xa4(%rbp)
movswl -0x3e(%rbp), %eax
movl %eax, -0xbc(%rbp)
movswl -0x9a(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xbc(%rbp), %eax
subl %ecx, %eax
movw %ax, -0xa2(%rbp)
movw $0x0, -0xa0(%rbp)
movswl -0x3e(%rbp), %eax
movl %eax, -0xb8(%rbp)
movswl -0x9a(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xb8(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x9e(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x1, %eax
jne 0x25f8c
movswl -0x40(%rbp), %eax
movswl -0x9c(%rbp), %ecx
subl %ecx, %eax
subl $0x4, %eax
movw %ax, -0xa4(%rbp)
movswl -0x40(%rbp), %eax
subl $0x4, %eax
movw %ax, -0xa0(%rbp)
jmp 0x25fb1
movswl -0x40(%rbp), %eax
addl $0x4, %eax
movw %ax, -0xa4(%rbp)
movswl -0x40(%rbp), %eax
movswl -0x9c(%rbp), %ecx
addl %ecx, %eax
addl $0x4, %eax
movw %ax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xd8(%rbp)
movb -0x31(%rbp), %al
movb %al, -0xc9(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7180
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movb -0xc9(%rbp), %cl
movq -0xc8(%rbp), %r8
leaq -0xa4(%rbp), %rdi
movl $0x4, %r9d
xorl %r10d, %r10d
movzbl %cl, %ecx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movzbl %al, %eax
movl %eax, 0x18(%rsp)
callq 0x5f210
jmp 0x2603a
jmp 0x2603c
movb -0x32(%rbp), %al
addb $0x1, %al
movb %al, -0x32(%rbp)
jmp 0x25d18
jmp 0x2604b
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)