// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_cpicker.c
// Function: draw_disc_grad
static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask, lv_opa_t opa_scale)
{
    lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
    int16_t start_angle = 0; /*Default*/
    int16_t end_angle = 360 - LV_CPICKER_DEF_QF; /*Default*/

    lv_coord_t w = lv_obj_get_width(cpicker);
    lv_coord_t h = lv_obj_get_height(cpicker);
    lv_coord_t cx = cpicker->coords.x1 + w / 2;
    lv_coord_t cy = cpicker->coords.y1 + h / 2;
    lv_coord_t r = w / 2;

    /*if the mask does not include the center of the object
    * redrawing all the wheel is not necessary;
    * only a given angular range
    */
    lv_point_t center = {cx, cy};
    if(!lv_area_is_point_on(mask, &center))
    {
        /*get angle from center of object to each corners of the area*/
        int16_t dr, ur, ul, dl;
        dr = lv_atan2(mask->x2 - cx, mask->y2 - cy);
        ur = lv_atan2(mask->x2 - cx, mask->y1 - cy);
        ul = lv_atan2(mask->x1 - cx, mask->y1 - cy);
        dl = lv_atan2(mask->x1 - cx, mask->y2 - cy);

        /*check area position from object axis*/
        bool left = (mask->x2 < cx && mask->x1 < cx) ? true : false;
        bool onYaxis = (mask->x2 > cx && mask->x1 < cx) ? true : false;
        bool right = (mask->x2 > cx && mask->x1 > cx) ? true : false;
        bool top = (mask->y2 < cy && mask->y1 < cy) ? true : false;
        bool onXaxis = (mask->y2 > cy && mask->y1 < cy) ? true : false;
        bool bottom = (mask->y2 > cy && mask->y1 > cy) ? true : false;

        /*store angular range*/
        if(right && bottom) {
            start_angle = dl;
            end_angle = ur;
        } else if(right && onXaxis) {
            start_angle = dl;
            end_angle = ul;
        } else if(right && top)  {
            start_angle = dr;
            end_angle = ul;
        } else if(onYaxis && top) {
            start_angle = dr;
            end_angle = dl;
        } else if(left && top)  {
            start_angle = ur;
            end_angle = dl;
        } else if(left && onXaxis) {
            start_angle = ur;
            end_angle = dr;
        } else if(left && bottom) {
            start_angle = ul;
            end_angle = dr;
        } else if(onYaxis && bottom) {
            start_angle = ul;
            end_angle = ur;
        }

        /*rollover angle*/
        if(start_angle > end_angle) end_angle += 360;

        /*round to QF factor*/
        start_angle = (start_angle/LV_CPICKER_DEF_QF) * LV_CPICKER_DEF_QF;
        end_angle = (end_angle / LV_CPICKER_DEF_QF) * LV_CPICKER_DEF_QF;

        /*shift angle if necessary before adding offset*/
        if((start_angle - LV_CPICKER_DEF_QF) < 0) {
            start_angle += 360;
            end_angle += 360;
        }

        /*ensure overlapping by adding offset*/
        start_angle -= LV_CPICKER_DEF_QF;
        end_angle += LV_CPICKER_DEF_QF;
    }

    lv_point_t triangle_points[3];
    lv_style_t style;
    lv_style_copy(&style, &lv_style_plain);
    uint16_t i;
    for(i = start_angle; i <= end_angle; i+= LV_CPICKER_DEF_QF) {
        style.body.main_color = angle_to_mode_color(cpicker, i);
        style.body.grad_color = style.body.main_color;

        triangle_points[0].x = cx;
        triangle_points[0].y = cy;

        triangle_points[1].x = cx + (r * lv_trigo_sin(i) >> LV_TRIGO_SHIFT);
        triangle_points[1].y = cy + (r * lv_trigo_sin(i + 90) >> LV_TRIGO_SHIFT);

        if(i == end_angle || i == (360 - LV_CPICKER_DEF_QF)) {
            /*the last triangle is drawn without additional overlapping pixels*/
            triangle_points[2].x = cx + (r * lv_trigo_sin(i + LV_CPICKER_DEF_QF) >> LV_TRIGO_SHIFT);
            triangle_points[2].y = cy + (r * lv_trigo_sin(i + LV_CPICKER_DEF_QF + 90) >> LV_TRIGO_SHIFT);
        } else {
            triangle_points[2].x = cx + (r * lv_trigo_sin(i + LV_CPICKER_DEF_QF + TRI_OFFSET) >> LV_TRIGO_SHIFT);
            triangle_points[2].y = cy + (r * lv_trigo_sin(i + LV_CPICKER_DEF_QF + TRI_OFFSET + 90) >> LV_TRIGO_SHIFT);
        }

        lv_draw_triangle(triangle_points, mask, &style, LV_OPA_COVER);
    }

    /*Mask out the center area*/
    const lv_style_t * style_main = lv_cpicker_get_style(cpicker, LV_CPICKER_STYLE_MAIN);
    lv_style_copy(&style, style_main);
    style.body.radius = LV_RADIUS_CIRCLE;
    lv_area_t area_mid;
    lv_area_copy(&area_mid, &cpicker->coords);
    lv_area_increment(&area_mid, -style_main->line.width);

    lv_draw_rect(&area_mid, mask, &style, opa_scale);

    if(ext->preview) {
        lv_color_t color = lv_cpicker_get_color(cpicker);
        style.body.main_color = color;
        style.body.grad_color = color;
        lv_area_increment(&area_mid, -style_main->line.width / 2);

        lv_draw_rect(&area_mid, mask, &style, opa_scale);
    }
}

// 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)
movw $0x0, -0x22(%rbp)
movw $0x165, -0x24(%rbp)     # imm = 0x165
movq -0x8(%rbp), %rdi
callq 0x8310
movw %ax, -0x26(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8350
movw %ax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movswl 0x20(%rax), %eax
movl %eax, -0xbc(%rbp)
movswl -0x26(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xbc(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x2a(%rbp)
movq -0x8(%rbp), %rax
movswl 0x22(%rax), %eax
movl %eax, -0xb8(%rbp)
movswl -0x28(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xb8(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x2c(%rbp)
movswl -0x26(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, -0x2e(%rbp)
movw -0x2a(%rbp), %ax
movw %ax, -0x32(%rbp)
movw -0x2c(%rbp), %ax
movw %ax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x32(%rbp), %rsi
callq 0x42a00
testb $0x1, %al
jne 0x1206d
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %edi
movswl -0x2a(%rbp), %eax
subl %eax, %edi
movq -0x10(%rbp), %rax
movswl 0x6(%rax), %esi
movswl -0x2c(%rbp), %eax
subl %eax, %esi
callq 0x473d0
movw %ax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %edi
movswl -0x2a(%rbp), %eax
subl %eax, %edi
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %esi
movswl -0x2c(%rbp), %eax
subl %eax, %esi
callq 0x473d0
movw %ax, -0x36(%rbp)
movq -0x10(%rbp), %rax
movswl (%rax), %edi
movswl -0x2a(%rbp), %eax
subl %eax, %edi
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %esi
movswl -0x2c(%rbp), %eax
subl %eax, %esi
callq 0x473d0
movw %ax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movswl (%rax), %edi
movswl -0x2a(%rbp), %eax
subl %eax, %edi
movq -0x10(%rbp), %rax
movswl 0x6(%rax), %esi
movswl -0x2c(%rbp), %eax
subl %eax, %esi
callq 0x473d0
movw %ax, -0x3a(%rbp)
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %ecx
movswl -0x2a(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xbd(%rbp)
jge 0x11d50
movq -0x10(%rbp), %rax
movswl (%rax), %eax
movswl -0x2a(%rbp), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0xbd(%rbp)
movb -0xbd(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x3b(%rbp)
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %ecx
movswl -0x2a(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xbe(%rbp)
jle 0x11d9c
movq -0x10(%rbp), %rax
movswl (%rax), %eax
movswl -0x2a(%rbp), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0xbe(%rbp)
movb -0xbe(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %ecx
movswl -0x2a(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xbf(%rbp)
jle 0x11de8
movq -0x10(%rbp), %rax
movswl (%rax), %eax
movswl -0x2a(%rbp), %ecx
cmpl %ecx, %eax
setg %al
movb %al, -0xbf(%rbp)
movb -0xbf(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x3d(%rbp)
movq -0x10(%rbp), %rax
movswl 0x6(%rax), %ecx
movswl -0x2c(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xc0(%rbp)
jge 0x11e35
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
movswl -0x2c(%rbp), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0xc0(%rbp)
movb -0xc0(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x3e(%rbp)
movq -0x10(%rbp), %rax
movswl 0x6(%rax), %ecx
movswl -0x2c(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xc1(%rbp)
jle 0x11e82
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
movswl -0x2c(%rbp), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0xc1(%rbp)
movb -0xc1(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x3f(%rbp)
movq -0x10(%rbp), %rax
movswl 0x6(%rax), %ecx
movswl -0x2c(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xc2(%rbp)
jle 0x11ecf
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
movswl -0x2c(%rbp), %ecx
cmpl %ecx, %eax
setg %al
movb %al, -0xc2(%rbp)
movb -0xc2(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, -0x40(%rbp)
testb $0x1, -0x3d(%rbp)
je 0x11f0e
testb $0x1, -0x40(%rbp)
je 0x11f0e
movw -0x3a(%rbp), %ax
movw %ax, -0x22(%rbp)
movw -0x36(%rbp), %ax
movw %ax, -0x24(%rbp)
jmp 0x11ff2
testb $0x1, -0x3d(%rbp)
je 0x11f2f
testb $0x1, -0x3f(%rbp)
je 0x11f2f
movw -0x3a(%rbp), %ax
movw %ax, -0x22(%rbp)
movw -0x38(%rbp), %ax
movw %ax, -0x24(%rbp)
jmp 0x11ff0
testb $0x1, -0x3d(%rbp)
je 0x11f50
testb $0x1, -0x3e(%rbp)
je 0x11f50
movw -0x34(%rbp), %ax
movw %ax, -0x22(%rbp)
movw -0x38(%rbp), %ax
movw %ax, -0x24(%rbp)
jmp 0x11fee
testb $0x1, -0x3c(%rbp)
je 0x11f6e
testb $0x1, -0x3e(%rbp)
je 0x11f6e
movw -0x34(%rbp), %ax
movw %ax, -0x22(%rbp)
movw -0x3a(%rbp), %ax
movw %ax, -0x24(%rbp)
jmp 0x11fec
testb $0x1, -0x3b(%rbp)
je 0x11f8c
testb $0x1, -0x3e(%rbp)
je 0x11f8c
movw -0x36(%rbp), %ax
movw %ax, -0x22(%rbp)
movw -0x3a(%rbp), %ax
movw %ax, -0x24(%rbp)
jmp 0x11fea
testb $0x1, -0x3b(%rbp)
je 0x11faa
testb $0x1, -0x3f(%rbp)
je 0x11faa
movw -0x36(%rbp), %ax
movw %ax, -0x22(%rbp)
movw -0x34(%rbp), %ax
movw %ax, -0x24(%rbp)
jmp 0x11fe8
testb $0x1, -0x3b(%rbp)
je 0x11fc8
testb $0x1, -0x40(%rbp)
je 0x11fc8
movw -0x38(%rbp), %ax
movw %ax, -0x22(%rbp)
movw -0x34(%rbp), %ax
movw %ax, -0x24(%rbp)
jmp 0x11fe6
testb $0x1, -0x3c(%rbp)
je 0x11fe4
testb $0x1, -0x40(%rbp)
je 0x11fe4
movw -0x38(%rbp), %ax
movw %ax, -0x22(%rbp)
movw -0x36(%rbp), %ax
movw %ax, -0x24(%rbp)
jmp 0x11fe6
jmp 0x11fe8
jmp 0x11fea
jmp 0x11fec
jmp 0x11fee
jmp 0x11ff0
jmp 0x11ff2
movswl -0x22(%rbp), %eax
movswl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jle 0x1200b
movswl -0x24(%rbp), %eax
addl $0x168, %eax            # imm = 0x168
movw %ax, -0x24(%rbp)
movswl -0x22(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
imull $0x3, %eax, %eax
movw %ax, -0x22(%rbp)
movswl -0x24(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
imull $0x3, %eax, %eax
movw %ax, -0x24(%rbp)
movswl -0x22(%rbp), %eax
subl $0x3, %eax
cmpl $0x0, %eax
jge 0x12057
movswl -0x22(%rbp), %eax
addl $0x168, %eax            # imm = 0x168
movw %ax, -0x22(%rbp)
movswl -0x24(%rbp), %eax
addl $0x168, %eax            # imm = 0x168
movw %ax, -0x24(%rbp)
movswl -0x22(%rbp), %eax
subl $0x3, %eax
movw %ax, -0x22(%rbp)
movswl -0x24(%rbp), %eax
addl $0x3, %eax
movw %ax, -0x24(%rbp)
leaq -0x98(%rbp), %rdi
leaq 0x76f6d(%rip), %rsi     # 0x88fe8
callq 0xc550
movw -0x22(%rbp), %ax
movw %ax, -0x9a(%rbp)
movzwl -0x9a(%rbp), %eax
movswl -0x24(%rbp), %ecx
cmpl %ecx, %eax
jg 0x122d4
movq -0x8(%rbp), %rdi
movzwl -0x9a(%rbp), %esi
callq 0x12740
movw %ax, -0x9c(%rbp)
movw -0x9c(%rbp), %ax
movw %ax, -0x96(%rbp)
movw -0x96(%rbp), %ax
movw %ax, -0x94(%rbp)
movw -0x2a(%rbp), %ax
movw %ax, -0x4c(%rbp)
movw -0x2c(%rbp), %ax
movw %ax, -0x4a(%rbp)
movswl -0x2a(%rbp), %eax
movl %eax, -0xd0(%rbp)
movswl -0x2e(%rbp), %eax
movl %eax, -0xd4(%rbp)
movswl -0x9a(%rbp), %edi
callq 0x47220
movl -0xd4(%rbp), %ecx
movw %ax, %dx
movl -0xd0(%rbp), %eax
movswl %dx, %edx
imull %edx, %ecx
sarl $0xf, %ecx
addl %ecx, %eax
movw %ax, -0x48(%rbp)
movswl -0x2c(%rbp), %eax
movl %eax, -0xc8(%rbp)
movswl -0x2e(%rbp), %eax
movl %eax, -0xcc(%rbp)
movzwl -0x9a(%rbp), %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x47220
movl -0xcc(%rbp), %ecx
movw %ax, %dx
movl -0xc8(%rbp), %eax
movswl %dx, %edx
imull %edx, %ecx
sarl $0xf, %ecx
addl %ecx, %eax
movw %ax, -0x46(%rbp)
movzwl -0x9a(%rbp), %eax
movswl -0x24(%rbp), %ecx
cmpl %ecx, %eax
je 0x12184
movzwl -0x9a(%rbp), %eax
cmpl $0x165, %eax            # imm = 0x165
jne 0x12214
movswl -0x2a(%rbp), %eax
movl %eax, -0xe0(%rbp)
movswl -0x2e(%rbp), %eax
movl %eax, -0xe4(%rbp)
movzwl -0x9a(%rbp), %eax
addl $0x3, %eax
movswl %ax, %edi
callq 0x47220
movl -0xe4(%rbp), %ecx
movw %ax, %dx
movl -0xe0(%rbp), %eax
movswl %dx, %edx
imull %edx, %ecx
sarl $0xf, %ecx
addl %ecx, %eax
movw %ax, -0x44(%rbp)
movswl -0x2c(%rbp), %eax
movl %eax, -0xd8(%rbp)
movswl -0x2e(%rbp), %eax
movl %eax, -0xdc(%rbp)
movzwl -0x9a(%rbp), %eax
addl $0x3, %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x47220
movl -0xdc(%rbp), %ecx
movw %ax, %dx
movl -0xd8(%rbp), %eax
movswl %dx, %edx
imull %edx, %ecx
sarl $0xf, %ecx
addl %ecx, %eax
movw %ax, -0x42(%rbp)
jmp 0x122a5
movswl -0x2a(%rbp), %eax
movl %eax, -0xf0(%rbp)
movswl -0x2e(%rbp), %eax
movl %eax, -0xf4(%rbp)
movzwl -0x9a(%rbp), %eax
addl $0x3, %eax
addl $0x2, %eax
movswl %ax, %edi
callq 0x47220
movl -0xf4(%rbp), %ecx
movw %ax, %dx
movl -0xf0(%rbp), %eax
movswl %dx, %edx
imull %edx, %ecx
sarl $0xf, %ecx
addl %ecx, %eax
movw %ax, -0x44(%rbp)
movswl -0x2c(%rbp), %eax
movl %eax, -0xe8(%rbp)
movswl -0x2e(%rbp), %eax
movl %eax, -0xec(%rbp)
movzwl -0x9a(%rbp), %eax
addl $0x3, %eax
addl $0x2, %eax
addl $0x5a, %eax
movswl %ax, %edi
callq 0x47220
movl -0xec(%rbp), %ecx
movw %ax, %dx
movl -0xe8(%rbp), %eax
movswl %dx, %edx
imull %edx, %ecx
sarl $0xf, %ecx
addl %ecx, %eax
movw %ax, -0x42(%rbp)
leaq -0x4c(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x98(%rbp), %rdx
movl $0xff, %ecx
callq 0x63fd0
movzwl -0x9a(%rbp), %eax
addl $0x3, %eax
movw %ax, -0x9a(%rbp)
jmp 0x1208b
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x11900
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xc550
movw $0x7c18, -0x92(%rbp)    # imm = 0x7C18
movq -0x8(%rbp), %rsi
addq $0x20, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x12860
movq -0xa8(%rbp), %rax
movswl 0x3e(%rax), %ecx
xorl %eax, %eax
subl %ecx, %eax
leaq -0xb0(%rbp), %rdi
movswl %ax, %esi
callq 0x42b50
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
leaq -0x98(%rbp), %rdx
movzbl -0x11(%rbp), %ecx
callq 0x5a9e0
movq -0x20(%rbp), %rax
movb 0x24(%rax), %al
shrb $0x4, %al
andb $0x1, %al
cmpb $0x0, %al
je 0x123cc
movq -0x8(%rbp), %rdi
callq 0x11a80
movw %ax, -0xb2(%rbp)
movw -0xb2(%rbp), %ax
movw %ax, -0x96(%rbp)
movw -0xb2(%rbp), %ax
movw %ax, -0x94(%rbp)
movq -0xa8(%rbp), %rax
movswl 0x3e(%rax), %ecx
xorl %eax, %eax
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
leaq -0xb0(%rbp), %rdi
movswl %ax, %esi
callq 0x42b50
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
leaq -0x98(%rbp), %rdx
movzbl -0x11(%rbp), %ecx
callq 0x5a9e0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)