// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_cpicker.c
// Function: draw_rect_grad
static void draw_rect_grad(lv_obj_t * cpicker, const lv_area_t * mask, lv_opa_t opa_scale)
{
    lv_style_t style;
    lv_style_copy(&style, lv_cpicker_get_style(cpicker, LV_CPICKER_STYLE_MAIN));

    lv_area_t grad_area;
    lv_obj_get_coords(cpicker, &grad_area);

    if(style.body.radius) {
        lv_coord_t h = lv_obj_get_height(cpicker);
        lv_coord_t r = style.body.radius;
        if(r > h / 2) r = h / 2;
        /*Make the gradient area smaller with a half circle on both ends*/
        grad_area.x1 += r;
        grad_area.x2 -= r;

        /*Draw the left rounded end*/
        lv_area_t rounded_edge_area;
        lv_obj_get_coords(cpicker, &rounded_edge_area);
        rounded_edge_area.x2 = rounded_edge_area.x1 + 2 * r;

        style.body.main_color = angle_to_mode_color(cpicker, 0);
        style.body.grad_color = style.body.main_color;

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

        /*Draw the right rounded end*/
        lv_obj_get_coords(cpicker, &rounded_edge_area);
        rounded_edge_area.x1 = rounded_edge_area.x2 - 2 * r;

        style.body.main_color = angle_to_mode_color(cpicker, 359);
        style.body.grad_color = style.body.main_color;

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

    lv_coord_t grad_w = lv_area_get_width(&grad_area);
    uint16_t i_step = LV_MATH_MAX(LV_CPICKER_DEF_QF, 360 / grad_w);
    style.body.radius = 0;
    style.body.border.width = 0;
    style.body.shadow.width = 0;
    style.body.opa = LV_OPA_COVER;

    uint16_t i;
    for(i = 0; i < 360; i += i_step) {
        style.body.main_color = angle_to_mode_color(cpicker, i);
        style.body.grad_color = style.body.main_color;

        /*the following attribute might need changing between index to add border, shadow, radius etc*/
        lv_area_t rect_area;

        /*scale angle (hue/sat/val) to linear coordinate*/
        lv_coord_t xi = (i * grad_w) / 360;

        rect_area.x1 = LV_MATH_MIN(grad_area.x1 + xi, grad_area.x1 + grad_w - i_step);
        rect_area.y1 = grad_area.y1;
        rect_area.x2 = rect_area.x1 + i_step;
        rect_area.y2 = grad_area.y2;

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x11900
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0xc550
movq -0x8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x7fb0
cmpw $0x0, -0x5a(%rbp)
je 0x1252f
movq -0x8(%rbp), %rdi
callq 0x8350
movw %ax, -0x6a(%rbp)
movw -0x5a(%rbp), %ax
movw %ax, -0x6c(%rbp)
movswl -0x6c(%rbp), %eax
movl %eax, -0x90(%rbp)
movswl -0x6a(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x90(%rbp), %eax
cmpl %ecx, %eax
jle 0x1246e
movswl -0x6a(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, -0x6c(%rbp)
movswl -0x6c(%rbp), %ecx
movswl -0x68(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x68(%rbp)
movswl -0x6c(%rbp), %ecx
movswl -0x64(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x64(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x74(%rbp), %rsi
callq 0x7fb0
movswl -0x74(%rbp), %eax
movswl -0x6c(%rbp), %ecx
shll %ecx
addl %ecx, %eax
movw %ax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x12740
movw %ax, -0x76(%rbp)
movw -0x76(%rbp), %ax
movw %ax, -0x5e(%rbp)
movw -0x5e(%rbp), %ax
movw %ax, -0x5c(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x74(%rbp), %rdi
leaq -0x60(%rbp), %rdx
movzbl -0x11(%rbp), %ecx
callq 0x5a9e0
movq -0x8(%rbp), %rdi
leaq -0x74(%rbp), %rsi
callq 0x7fb0
movswl -0x70(%rbp), %eax
movswl -0x6c(%rbp), %ecx
shll %ecx
subl %ecx, %eax
movw %ax, -0x74(%rbp)
movq -0x8(%rbp), %rdi
movl $0x167, %esi            # imm = 0x167
callq 0x12740
movw %ax, -0x78(%rbp)
movw -0x78(%rbp), %ax
movw %ax, -0x5e(%rbp)
movw -0x5e(%rbp), %ax
movw %ax, -0x5c(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x74(%rbp), %rdi
leaq -0x60(%rbp), %rdx
movzbl -0x11(%rbp), %ecx
callq 0x5a9e0
leaq -0x68(%rbp), %rdi
callq 0x12880
movw %ax, -0x7a(%rbp)
movswl -0x7a(%rbp), %ecx
movl $0x168, %eax            # imm = 0x168
cltd
idivl %ecx
movl %eax, %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jle 0x12560
movl $0x3, %eax
movl %eax, -0x94(%rbp)
jmp 0x12572
movswl -0x7a(%rbp), %ecx
movl $0x168, %eax            # imm = 0x168
cltd
idivl %ecx
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movw %ax, -0x7c(%rbp)
movw $0x0, -0x5a(%rbp)
movw $0x0, -0x54(%rbp)
movw $0x0, -0x4e(%rbp)
movb $-0x1, -0x58(%rbp)
movw $0x0, -0x7e(%rbp)
movzwl -0x7e(%rbp), %eax
cmpl $0x168, %eax            # imm = 0x168
jge 0x12690
movq -0x8(%rbp), %rdi
movzwl -0x7e(%rbp), %esi
callq 0x12740
movw %ax, -0x80(%rbp)
movw -0x80(%rbp), %ax
movw %ax, -0x5e(%rbp)
movw -0x5e(%rbp), %ax
movw %ax, -0x5c(%rbp)
movzwl -0x7e(%rbp), %eax
movswl -0x7a(%rbp), %ecx
imull %ecx, %eax
movl $0x168, %ecx            # imm = 0x168
cltd
idivl %ecx
movw %ax, -0x8a(%rbp)
movswl -0x68(%rbp), %eax
movswl -0x8a(%rbp), %ecx
addl %ecx, %eax
movswl -0x68(%rbp), %ecx
movswl -0x7a(%rbp), %edx
addl %edx, %ecx
movzwl -0x7c(%rbp), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jge 0x12618
movswl -0x68(%rbp), %eax
movswl -0x8a(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x98(%rbp)
jmp 0x1262e
movswl -0x68(%rbp), %eax
movswl -0x7a(%rbp), %ecx
addl %ecx, %eax
movzwl -0x7c(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
movw %ax, -0x88(%rbp)
movw -0x66(%rbp), %ax
movw %ax, -0x86(%rbp)
movswl -0x88(%rbp), %eax
movzwl -0x7c(%rbp), %ecx
addl %ecx, %eax
movw %ax, -0x84(%rbp)
movw -0x62(%rbp), %ax
movw %ax, -0x82(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x88(%rbp), %rdi
leaq -0x60(%rbp), %rdx
movzbl -0x11(%rbp), %ecx
callq 0x5a9e0
movzwl -0x7c(%rbp), %ecx
movzwl -0x7e(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x7e(%rbp)
jmp 0x12598
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)