// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_rect.c
// Function: lv_draw_shadow_bottom
static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style,
                                  lv_opa_t opa_scale)
{
    bool aa           = lv_disp_get_antialiasing(lv_refr_get_disp_refreshing());
    lv_coord_t radius = style->body.radius;
    lv_coord_t swidth = style->body.shadow.width;
    lv_coord_t width  = lv_area_get_width(coords);
    lv_coord_t height = lv_area_get_height(coords);

    radius = lv_draw_cont_radius_corr(radius, width, height);
    radius += aa * SHADOW_BOTTOM_AA_EXTRA_RADIUS;
    swidth += aa;

    uint32_t curve_x_size = ((radius + 1) + 3) & ~0x3; /*Round to 4*/
    curve_x_size *= sizeof(lv_coord_t);
    lv_opa_t line_1d_blur_size = (swidth + 3) & ~0x3;     /*Round to 4*/
    line_1d_blur_size *= sizeof(lv_opa_t);

    uint8_t * draw_buf = lv_draw_get_buf(curve_x_size + line_1d_blur_size);

    /*Divide the draw buffer*/
    lv_coord_t  * curve_x = (lv_coord_t *)&draw_buf[0]; /*Stores the 'x' coordinates of a quarter circle.*/
    lv_opa_t * line_1d_blur = (lv_opa_t *)&draw_buf[curve_x_size];

    lv_point_t circ;
    lv_coord_t circ_tmp;
    lv_circ_init(&circ, &circ_tmp, radius);
    while(lv_circ_cont(&circ)) {
        curve_x[LV_CIRC_OCT1_Y(circ)] = LV_CIRC_OCT1_X(circ);
        curve_x[LV_CIRC_OCT2_Y(circ)] = LV_CIRC_OCT2_X(circ);
        lv_circ_next(&circ, &circ_tmp);
    }

    int16_t col;

    lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.opa : (uint16_t)((uint16_t)style->body.opa * opa_scale) >> 8;
    for(col = 0; col < swidth; col++) {
        line_1d_blur[col] = (uint32_t)((uint32_t)(swidth - col) * opa / 2) / (swidth);
    }

    lv_point_t point_l;
    lv_point_t point_r;
    lv_area_t area_mid;
    lv_point_t ofs_l;
    lv_point_t ofs_r;

    ofs_l.x = coords->x1 + radius;
    ofs_l.y = coords->y2 - radius + 1 - aa;

    ofs_r.x = coords->x2 - radius;
    ofs_r.y = coords->y2 - radius + 1 - aa;

    for(col = 0; col <= radius; col++) {
        point_l.x = ofs_l.x - col;
        point_l.y = ofs_l.y + curve_x[col];

        point_r.x = ofs_r.x + col;
        point_r.y = ofs_r.y + curve_x[col];

        lv_opa_t px_opa;
        int16_t diff = col == 0 ? 0 : curve_x[col - 1] - curve_x[col];
        uint16_t d;
        for(d = 0; d < swidth; d++) {
            /*When stepping a pixel in y calculate the average with the pixel from the prev. column
             * to make a blur */
            if(diff == 0) {
                px_opa = line_1d_blur[d];
            } else {
                px_opa = (uint16_t)((uint16_t)line_1d_blur[d] + line_1d_blur[d - diff]) >> 1;
            }
            lv_draw_px(point_l.x, point_l.y, mask, style->body.shadow.color, px_opa);
            point_l.y++;

            /*Don't overdraw the pixel on the middle*/
            if(point_r.x > ofs_l.x) {
                lv_draw_px(point_r.x, point_r.y, mask, style->body.shadow.color, px_opa);
            }
            point_r.y++;
        }
    }

    area_mid.x1 = ofs_l.x + 1;
    area_mid.y1 = ofs_l.y + radius;
    area_mid.x2 = ofs_r.x - 1;
    area_mid.y2 = area_mid.y1;

    uint16_t d;
    for(d = 0; d < swidth; d++) {
        lv_draw_fill(&area_mid, mask, style->body.shadow.color, line_1d_blur[d]);
        area_mid.y1++;
        area_mid.y2++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb %al, -0x19(%rbp)
callq 0xafe0
movq %rax, %rdi
callq 0xdb00
andb $0x1, %al
movb %al, -0x1a(%rbp)
movq -0x18(%rbp), %rax
movw 0x6(%rax), %ax
movw %ax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movw 0x12(%rax), %ax
movw %ax, -0x1e(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5ab30
movw %ax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5ab10
movw %ax, -0x22(%rbp)
movw -0x1c(%rbp), %cx
movw -0x20(%rbp), %ax
movzwl %cx, %edi
movswl %ax, %esi
movswl -0x22(%rbp), %edx
callq 0x5e0e0
movw %ax, -0x1c(%rbp)
movb -0x1a(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
imull $0x3, %eax, %ecx
movswl -0x1c(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x1c(%rbp)
movb -0x1a(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movswl -0x1e(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x1e(%rbp)
movswl -0x1c(%rbp), %eax
addl $0x1, %eax
addl $0x3, %eax
andl $-0x4, %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
shlq %rax
movl %eax, -0x28(%rbp)
movswl -0x1e(%rbp), %eax
addl $0x3, %eax
andl $-0x4, %eax
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %eax
shlq $0x0, %rax
movb %al, -0x29(%rbp)
movl -0x28(%rbp), %edi
movzbl -0x29(%rbp), %eax
addl %eax, %edi
callq 0x5a6a0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movl -0x28(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
leaq -0x4c(%rbp), %rdi
leaq -0x4e(%rbp), %rsi
movswl -0x1c(%rbp), %edx
callq 0x42540
leaq -0x4c(%rbp), %rdi
callq 0x42580
testb $0x1, %al
jne 0x5ebdb
jmp 0x5ec0c
movw -0x4c(%rbp), %dx
movq -0x40(%rbp), %rax
movswq -0x4a(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movw -0x4a(%rbp), %dx
movq -0x40(%rbp), %rax
movswq -0x4c(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
leaq -0x4c(%rbp), %rdi
leaq -0x4e(%rbp), %rsi
callq 0x425b0
jmp 0x5ebcc
movzbl -0x19(%rbp), %eax
cmpl $0xff, %eax
jne 0x5ec24
movq -0x18(%rbp), %rax
movzbl 0x8(%rax), %eax
movl %eax, -0x78(%rbp)
jmp 0x5ec3f
movq -0x18(%rbp), %rax
movzbl 0x8(%rax), %eax
movzwl %ax, %eax
movzbl -0x19(%rbp), %ecx
imull %ecx, %eax
movzwl %ax, %eax
sarl $0x8, %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movb %al, -0x51(%rbp)
movw $0x0, -0x50(%rbp)
movswl -0x50(%rbp), %eax
movswl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5ec8e
movswl -0x1e(%rbp), %eax
movswl -0x50(%rbp), %ecx
subl %ecx, %eax
movzbl -0x51(%rbp), %ecx
imull %ecx, %eax
shrl %eax
movswl -0x1e(%rbp), %ecx
xorl %edx, %edx
divl %ecx
movb %al, %dl
movq -0x48(%rbp), %rax
movswq -0x50(%rbp), %rcx
movb %dl, (%rax,%rcx)
movw -0x50(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x50(%rbp)
jmp 0x5ec4b
movq -0x8(%rbp), %rax
movswl (%rax), %eax
movswl -0x1c(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x66(%rbp)
movq -0x8(%rbp), %rax
movswl 0x6(%rax), %eax
movswl -0x1c(%rbp), %ecx
subl %ecx, %eax
addl $0x1, %eax
movb -0x1a(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
subl %ecx, %eax
movw %ax, -0x64(%rbp)
movq -0x8(%rbp), %rax
movswl 0x4(%rax), %eax
movswl -0x1c(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x6a(%rbp)
movq -0x8(%rbp), %rax
movswl 0x6(%rax), %eax
movswl -0x1c(%rbp), %ecx
subl %ecx, %eax
addl $0x1, %eax
movb -0x1a(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
subl %ecx, %eax
movw %ax, -0x68(%rbp)
movw $0x0, -0x50(%rbp)
movswl -0x50(%rbp), %eax
movswl -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jg 0x5ee7d
movswl -0x66(%rbp), %eax
movswl -0x50(%rbp), %ecx
subl %ecx, %eax
movw %ax, -0x56(%rbp)
movswl -0x64(%rbp), %eax
movq -0x40(%rbp), %rcx
movswq -0x50(%rbp), %rdx
movswl (%rcx,%rdx,2), %ecx
addl %ecx, %eax
movw %ax, -0x54(%rbp)
movswl -0x6a(%rbp), %eax
movswl -0x50(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x5a(%rbp)
movswl -0x68(%rbp), %eax
movq -0x40(%rbp), %rcx
movswq -0x50(%rbp), %rdx
movswl (%rcx,%rdx,2), %ecx
addl %ecx, %eax
movw %ax, -0x58(%rbp)
movswl -0x50(%rbp), %eax
cmpl $0x0, %eax
jne 0x5ed61
xorl %eax, %eax
movl %eax, -0x7c(%rbp)
jmp 0x5ed85
movq -0x40(%rbp), %rax
movswl -0x50(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movswl (%rax,%rcx,2), %eax
movq -0x40(%rbp), %rcx
movswq -0x50(%rbp), %rdx
movswl (%rcx,%rdx,2), %ecx
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movw %ax, -0x6e(%rbp)
movw $0x0, -0x70(%rbp)
movzwl -0x70(%rbp), %eax
movswl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5ee6a
movswl -0x6e(%rbp), %eax
cmpl $0x0, %eax
jne 0x5edbb
movq -0x48(%rbp), %rax
movzwl -0x70(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x6b(%rbp)
jmp 0x5ede9
movq -0x48(%rbp), %rax
movzwl -0x70(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movzwl %ax, %eax
movq -0x48(%rbp), %rcx
movzwl -0x70(%rbp), %edx
movswl -0x6e(%rbp), %esi
subl %esi, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
addl %ecx, %eax
movzwl %ax, %eax
sarl %eax
movb %al, -0x6b(%rbp)
movw -0x56(%rbp), %di
movw -0x54(%rbp), %si
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movb -0x6b(%rbp), %al
movswl %di, %edi
movswl %si, %esi
movzwl 0x10(%rcx), %ecx
movzbl %al, %r8d
callq 0x58ba0
movw -0x54(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x54(%rbp)
movswl -0x5a(%rbp), %eax
movswl -0x66(%rbp), %ecx
cmpl %ecx, %eax
jle 0x5ee4d
movw -0x5a(%rbp), %di
movw -0x58(%rbp), %si
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movb -0x6b(%rbp), %al
movswl %di, %edi
movswl %si, %esi
movzwl 0x10(%rcx), %ecx
movzbl %al, %r8d
callq 0x58ba0
movw -0x58(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x58(%rbp)
movw -0x70(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x70(%rbp)
jmp 0x5ed92
jmp 0x5ee6c
movw -0x50(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x50(%rbp)
jmp 0x5ecf7
movswl -0x66(%rbp), %eax
addl $0x1, %eax
movw %ax, -0x62(%rbp)
movswl -0x64(%rbp), %eax
movswl -0x1c(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x60(%rbp)
movswl -0x6a(%rbp), %eax
subl $0x1, %eax
movw %ax, -0x5e(%rbp)
movw -0x60(%rbp), %ax
movw %ax, -0x5c(%rbp)
movw $0x0, -0x72(%rbp)
movzwl -0x72(%rbp), %eax
movswl -0x1e(%rbp), %ecx
cmpl %ecx, %eax
jge 0x5ef04
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rcx
movq -0x48(%rbp), %rax
movzwl -0x72(%rbp), %edx
movb (%rax,%rdx), %al
leaq -0x62(%rbp), %rdi
movzwl 0x10(%rcx), %edx
movzbl %al, %ecx
callq 0x58ea0
movw -0x60(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x60(%rbp)
movw -0x5c(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x5c(%rbp)
movw -0x72(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x72(%rbp)
jmp 0x5eeaf
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)