// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_calendar.c
// Function: draw_days
static void draw_days(lv_obj_t * calendar, const lv_area_t * mask)
{
    lv_calendar_ext_t * ext     = lv_obj_get_ext_attr(calendar);
    lv_bidi_dir_t bidi_dir = lv_obj_get_base_dir(calendar);
    const lv_style_t * style_bg = lv_calendar_get_style(calendar, LV_CALENDAR_STYLE_BG);
    lv_area_t label_area;
    lv_opa_t opa_scale = lv_obj_get_opa_scale(calendar);
    label_area.y1      = calendar->coords.y1 + get_header_height(calendar) + ext->style_day_names->body.padding.top +
                    lv_font_get_line_height(ext->style_day_names->text.font) +
                    ext->style_day_names->body.padding.bottom;
    label_area.y2 = label_area.y1 + lv_font_get_line_height(style_bg->text.font);

    lv_coord_t w          = lv_obj_get_width(calendar) - style_bg->body.padding.left - style_bg->body.padding.right;
    lv_coord_t h          = calendar->coords.y2 - label_area.y1 - style_bg->body.padding.bottom;
    lv_coord_t box_w      = w / 7;
    lv_coord_t vert_space = (h - (6 * lv_font_get_line_height(style_bg->text.font))) / 5;

    uint32_t week;
    uint8_t day_cnt;
    uint8_t month_start_day = get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1);
    day_draw_state_t draw_state; /*true: Not the prev. or next month is drawn*/
    const lv_style_t * act_style;

    /*If starting with the first day of the week then the previous month is not visible*/
    if(month_start_day == 0) {
        day_cnt    = 1;
        draw_state = DAY_DRAW_ACT_MONTH;
        act_style  = style_bg;
    } else {
        draw_state = DAY_DRAW_PREV_MONTH;
        day_cnt = get_month_length(ext->showed_date.year, ext->showed_date.month - 1); /*Length of the previous month*/
        day_cnt -= month_start_day - 1; /*First visible number of the previous month*/
        act_style = ext->style_inactive_days;
    }

    bool month_of_today_shown = false;
    if(ext->showed_date.year == ext->today.year && ext->showed_date.month == ext->today.month) {
        month_of_today_shown = true;
    }

    char buf[3];
    bool in_week_box = false;

    /*Draw 6 weeks*/
    for(week = 0; week < 6; week++) {

        /*Draw the "week box"*/
        if(month_of_today_shown &&
           ((draw_state == DAY_DRAW_ACT_MONTH && ext->today.day >= day_cnt && ext->today.day < day_cnt + 7) ||
            (draw_state == DAY_DRAW_PREV_MONTH && ext->today.day <= 7 - month_start_day && week == 0))) {
            lv_area_t week_box_area;
            lv_area_copy(&week_box_area, &label_area); /*'label_area' is already set for this row*/
            week_box_area.x1 =
                calendar->coords.x1 + style_bg->body.padding.left - ext->style_week_box->body.padding.left;
            week_box_area.x2 =
                calendar->coords.x2 - style_bg->body.padding.right + ext->style_week_box->body.padding.right;

            week_box_area.y1 -= ext->style_week_box->body.padding.top;
            week_box_area.y2 += ext->style_week_box->body.padding.bottom;
            lv_draw_rect(&week_box_area, mask, ext->style_week_box, opa_scale);

            in_week_box = true;
        } else {
            in_week_box = false;
        }

        /*Draw the 7 days of a week*/
        uint32_t day;
        for(day = 0; day < 7; day++) {
            /*The previous month is over*/
            if(draw_state == DAY_DRAW_PREV_MONTH && day == month_start_day) {
                draw_state = DAY_DRAW_ACT_MONTH;
                day_cnt    = 1;
                act_style  = style_bg;
            }
            /*The current month is over*/
            if(draw_state == DAY_DRAW_ACT_MONTH &&
               day_cnt > get_month_length(ext->showed_date.year, ext->showed_date.month)) {
                draw_state = DAY_DRAW_NEXT_MONTH;
                day_cnt    = 1;
                act_style  = ext->style_inactive_days;
            }

            label_area.x1 =
                calendar->coords.x1 + (w * day) / 7 + style_bg->body.padding.left;
            label_area.x2 = label_area.x1 + box_w - 1;

            /*Draw the "today box"*/
            if(draw_state == DAY_DRAW_ACT_MONTH && month_of_today_shown && ext->today.day == day_cnt) {
                lv_area_t today_box_area;
                lv_area_copy(&today_box_area, &label_area);
                today_box_area.x1 = label_area.x1;
                today_box_area.x2 = label_area.x2;

                today_box_area.y1 = label_area.y1 - ext->style_today_box->body.padding.top;
                today_box_area.y2 = label_area.y2 + ext->style_today_box->body.padding.bottom;
                lv_draw_rect(&today_box_area, mask, ext->style_today_box, opa_scale);
            }

            /*Get the final style : highlighted/week box/today box/normal*/
            const lv_style_t * final_style;
            if(draw_state == DAY_DRAW_PREV_MONTH &&
               is_highlighted(calendar, ext->showed_date.year - (ext->showed_date.month == 1 ? 1 : 0),
                              ext->showed_date.month == 1 ? 12 : ext->showed_date.month - 1, day_cnt)) {
                final_style = ext->style_highlighted_days;
            } else if(draw_state == DAY_DRAW_ACT_MONTH &&
                      is_highlighted(calendar, ext->showed_date.year, ext->showed_date.month, day_cnt)) {
                final_style = ext->style_highlighted_days;
            } else if(draw_state == DAY_DRAW_NEXT_MONTH &&
                      is_highlighted(calendar, ext->showed_date.year + (ext->showed_date.month == 12 ? 1 : 0),
                                     ext->showed_date.month == 12 ? 1 : ext->showed_date.month + 1, day_cnt)) {
                final_style = ext->style_highlighted_days;
            } else if(month_of_today_shown && day_cnt == ext->today.day && draw_state == DAY_DRAW_ACT_MONTH)
                final_style = ext->style_today_box;
            else if(in_week_box && draw_state == DAY_DRAW_ACT_MONTH)
                final_style = ext->style_week_box;
            else
                final_style = act_style;

            /*Write the day's number*/
            lv_utils_num_to_str(day_cnt, buf);
            lv_draw_label(&label_area, mask, final_style, opa_scale, buf, LV_TXT_FLAG_CENTER, NULL, NULL, NULL, bidi_dir);

            /*Go to the next day*/
            day_cnt++;
        }

        /*Got to the next weeks row*/
        label_area.y1 += vert_space + lv_font_get_line_height(style_bg->text.font);
        label_area.y2 += vert_space + lv_font_get_line_height(style_bg->text.font);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x7180
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x21b80
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa710
movb %al, -0x31(%rbp)
movq -0x8(%rbp), %rax
movswl 0x22(%rax), %eax
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0x227d0
movw %ax, %cx
movl -0x88(%rbp), %eax
movswl %cx, %ecx
addl %ecx, %eax
movq -0x18(%rbp), %rcx
movq 0x38(%rcx), %rcx
movswl 0x16(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x84(%rbp)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq 0x28(%rax), %rdi
callq 0x228a0
movb %al, %cl
movl -0x84(%rbp), %eax
movzbl %cl, %ecx
addl %ecx, %eax
movq -0x18(%rbp), %rcx
movq 0x38(%rcx), %rcx
movswl 0x18(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x2e(%rbp)
movswl -0x2e(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x228a0
movb %al, %cl
movl -0x80(%rbp), %eax
movzbl %cl, %ecx
addl %ecx, %eax
movw %ax, -0x2a(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8310
cwtl
movq -0x28(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
subl %ecx, %eax
movq -0x28(%rbp), %rcx
movswl 0x1c(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movswl 0x26(%rax), %eax
movswl -0x2e(%rbp), %ecx
subl %ecx, %eax
movq -0x28(%rbp), %rcx
movswl 0x18(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x36(%rbp)
movswl -0x34(%rbp), %eax
movl $0x7, %ecx
cltd
idivl %ecx
movw %ax, -0x38(%rbp)
movswl -0x36(%rbp), %eax
movl %eax, -0x7c(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x228a0
movb %al, %cl
movl -0x7c(%rbp), %eax
movzbl %cl, %ecx
imull $0x6, %ecx, %ecx
subl %ecx, %eax
movl $0x5, %ecx
cltd
idivl %ecx
movw %ax, -0x3a(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %edi
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %esi
movl $0x1, %edx
callq 0x22920
movb %al, -0x42(%rbp)
movzbl -0x42(%rbp), %eax
cmpl $0x0, %eax
jne 0x22255
movb $0x1, -0x41(%rbp)
movb $0x1, -0x43(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x22290
movb $0x0, -0x43(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %edi
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %esi
subl $0x1, %esi
callq 0x229c0
movb %al, -0x41(%rbp)
movzbl -0x42(%rbp), %ecx
subl $0x1, %ecx
movzbl -0x41(%rbp), %eax
subl %ecx, %eax
movb %al, -0x41(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x50(%rbp)
movb $0x0, -0x51(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
movzwl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x222bf
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %eax
movq -0x18(%rbp), %rcx
movsbl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jne 0x222bf
movb $0x1, -0x51(%rbp)
movb $0x0, -0x55(%rbp)
movl $0x0, -0x40(%rbp)
cmpl $0x6, -0x40(%rbp)
jae 0x227c1
testb $0x1, -0x51(%rbp)
je 0x223dc
movzbl -0x43(%rbp), %eax
cmpl $0x1, %eax
jne 0x2230a
movq -0x18(%rbp), %rax
movsbl 0x3(%rax), %eax
movzbl -0x41(%rbp), %ecx
cmpl %ecx, %eax
jl 0x2230a
movq -0x18(%rbp), %rax
movsbl 0x3(%rax), %eax
movzbl -0x41(%rbp), %ecx
addl $0x7, %ecx
cmpl %ecx, %eax
jl 0x2233c
movzbl -0x43(%rbp), %eax
cmpl $0x0, %eax
jne 0x223dc
movq -0x18(%rbp), %rax
movsbl 0x3(%rax), %eax
movzbl -0x42(%rbp), %edx
movl $0x7, %ecx
subl %edx, %ecx
cmpl %ecx, %eax
jg 0x223dc
cmpl $0x0, -0x40(%rbp)
jne 0x223dc
leaq -0x5e(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x22a50
movq -0x8(%rbp), %rax
movswl 0x20(%rax), %eax
movq -0x28(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
addl %ecx, %eax
movq -0x18(%rbp), %rcx
movq 0x50(%rcx), %rcx
movswl 0x1a(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x5e(%rbp)
movq -0x8(%rbp), %rax
movswl 0x24(%rax), %eax
movq -0x28(%rbp), %rcx
movswl 0x1c(%rcx), %ecx
subl %ecx, %eax
movq -0x18(%rbp), %rcx
movq 0x50(%rcx), %rcx
movswl 0x1c(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x5a(%rbp)
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movswl 0x16(%rax), %ecx
movswl -0x5c(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movswl 0x18(%rax), %ecx
movswl -0x58(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x58(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rdx
leaq -0x5e(%rbp), %rdi
movzbl -0x31(%rbp), %ecx
callq 0x5a9e0
movb $0x1, -0x55(%rbp)
jmp 0x223e0
movb $0x0, -0x55(%rbp)
movl $0x0, -0x64(%rbp)
cmpl $0x7, -0x64(%rbp)
jae 0x2275b
movzbl -0x43(%rbp), %eax
cmpl $0x0, %eax
jne 0x22415
movl -0x64(%rbp), %eax
movzbl -0x42(%rbp), %ecx
cmpl %ecx, %eax
jne 0x22415
movb $0x1, -0x43(%rbp)
movb $0x1, -0x41(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movzbl -0x43(%rbp), %eax
cmpl $0x1, %eax
jne 0x22460
movzbl -0x41(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %edi
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %esi
callq 0x229c0
movb %al, %cl
movl -0x8c(%rbp), %eax
movzbl %cl, %ecx
cmpl %ecx, %eax
jle 0x22460
movb $0x2, -0x43(%rbp)
movb $0x1, -0x41(%rbp)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movswl 0x20(%rax), %eax
movl %eax, -0x90(%rbp)
movswl -0x34(%rbp), %eax
imull -0x64(%rbp), %eax
movl $0x7, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movl -0x90(%rbp), %eax
addl %ecx, %eax
movq -0x28(%rbp), %rcx
movswl 0x1a(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x30(%rbp)
movswl -0x30(%rbp), %eax
movswl -0x38(%rbp), %ecx
addl %ecx, %eax
subl $0x1, %eax
movw %ax, -0x2c(%rbp)
movzbl -0x43(%rbp), %eax
cmpl $0x1, %eax
jne 0x22529
testb $0x1, -0x51(%rbp)
je 0x22529
movq -0x18(%rbp), %rax
movsbl 0x3(%rax), %eax
movzbl -0x41(%rbp), %ecx
cmpl %ecx, %eax
jne 0x22529
leaq -0x6c(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x22a50
movw -0x30(%rbp), %ax
movw %ax, -0x6c(%rbp)
movw -0x2c(%rbp), %ax
movw %ax, -0x68(%rbp)
movswl -0x2e(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x58(%rcx), %rcx
movswl 0x16(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x6a(%rbp)
movswl -0x2a(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x58(%rcx), %rcx
movswl 0x18(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x66(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rdx
leaq -0x6c(%rbp), %rdi
movzbl -0x31(%rbp), %ecx
callq 0x5a9e0
movzbl -0x43(%rbp), %eax
cmpl $0x0, %eax
jne 0x225c4
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
movsbl 0x6(%rcx), %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x1, %esi
cmovel %edx, %ecx
subl %ecx, %eax
movl %eax, -0x94(%rbp)
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0x1, %eax
jne 0x22580
movl $0xc, %eax
movl %eax, -0xa4(%rbp)
jmp 0x22591
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %eax
subl $0x1, %eax
movl %eax, -0xa4(%rbp)
movl -0x94(%rbp), %esi
movq -0xa0(%rbp), %rdi
movl -0xa4(%rbp), %edx
movzbl -0x41(%rbp), %ecx
callq 0x22a70
testb $0x1, %al
jne 0x225b3
jmp 0x225c4
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x226f3
movzbl -0x43(%rbp), %eax
cmpl $0x1, %eax
jne 0x22601
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %esi
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %edx
movzbl -0x41(%rbp), %ecx
callq 0x22a70
testb $0x1, %al
jne 0x225f0
jmp 0x22601
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x226f1
movzbl -0x43(%rbp), %eax
cmpl $0x2, %eax
jne 0x22699
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
movsbl 0x6(%rcx), %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0xc, %esi
cmovel %edx, %ecx
addl %ecx, %eax
movl %eax, -0xa8(%rbp)
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %eax
cmpl $0xc, %eax
jne 0x22658
movl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x22669
movq -0x18(%rbp), %rax
movsbl 0x6(%rax), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
movl -0xa8(%rbp), %esi
movq -0xb0(%rbp), %rdi
movl -0xb4(%rbp), %edx
movzbl -0x41(%rbp), %ecx
callq 0x22a70
testb $0x1, %al
jne 0x2268b
jmp 0x22699
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x226ef
testb $0x1, -0x51(%rbp)
je 0x226c6
movzbl -0x41(%rbp), %eax
movq -0x18(%rbp), %rcx
movsbl 0x3(%rcx), %ecx
cmpl %ecx, %eax
jne 0x226c6
movzbl -0x43(%rbp), %eax
cmpl $0x1, %eax
jne 0x226c6
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x226ed
testb $0x1, -0x55(%rbp)
je 0x226e3
movzbl -0x43(%rbp), %eax
cmpl $0x1, %eax
jne 0x226e3
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x226eb
movq -0x50(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x226ed
jmp 0x226ef
jmp 0x226f1
jmp 0x226f3
movzbl -0x41(%rbp), %edi
leaq -0x54(%rbp), %rsi
callq 0x475d0
movq -0x10(%rbp), %rsi
movq -0x78(%rbp), %rdx
movb -0x31(%rbp), %al
leaq -0x54(%rbp), %r8
leaq -0x30(%rbp), %rdi
movl $0x4, %r9d
xorl %ecx, %ecx
movzbl %al, %ecx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movzbl -0x19(%rbp), %eax
movl %eax, 0x18(%rsp)
callq 0x5f210
movb -0x41(%rbp), %al
addb $0x1, %al
movb %al, -0x41(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x223e7
movswl -0x3a(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x228a0
movl -0xbc(%rbp), %ecx
movzbl %al, %eax
addl %eax, %ecx
movswl -0x2e(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x2e(%rbp)
movswl -0x3a(%rbp), %eax
movl %eax, -0xb8(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x228a0
movl -0xb8(%rbp), %ecx
movzbl %al, %eax
addl %eax, %ecx
movswl -0x2a(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x2a(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x222ca
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)