// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_line.c
// Function: lv_line_design
static bool lv_line_design(lv_obj_t * line, const lv_area_t * mask, lv_design_mode_t mode)
{
    /*A line never covers an area*/
    if(mode == LV_DESIGN_COVER_CHK)
        return false;
    else if(mode == LV_DESIGN_DRAW_MAIN) {
        lv_line_ext_t * ext = lv_obj_get_ext_attr(line);

        if(ext->point_num == 0 || ext->point_array == NULL) return false;

        const lv_style_t * style = lv_obj_get_style(line);
        lv_opa_t opa_scale       = lv_obj_get_opa_scale(line);
        lv_area_t area;
        lv_obj_get_coords(line, &area);
        lv_coord_t x_ofs = area.x1;
        lv_coord_t y_ofs = area.y1;
        lv_point_t p1;
        lv_point_t p2;
        lv_coord_t h = lv_obj_get_height(line);
        uint16_t i;

        lv_style_t circle_style_tmp; /*If rounded...*/
        if(style->line.rounded) {
            lv_style_copy(&circle_style_tmp, style);
            circle_style_tmp.body.radius     = LV_RADIUS_CIRCLE;
            circle_style_tmp.body.main_color = style->line.color;
            circle_style_tmp.body.grad_color = style->line.color;
            circle_style_tmp.body.opa        = style->line.opa;
        }
        lv_area_t circle_area;

        /*Read all points and draw the lines*/
        for(i = 0; i < ext->point_num - 1; i++) {

            p1.x = ext->point_array[i].x + x_ofs;
            p2.x = ext->point_array[i + 1].x + x_ofs;

            if(ext->y_inv == 0) {
                p1.y = ext->point_array[i].y + y_ofs;
                p2.y = ext->point_array[i + 1].y + y_ofs;
            } else {
                p1.y = h - ext->point_array[i].y + y_ofs;
                p2.y = h - ext->point_array[i + 1].y + y_ofs;
            }
            lv_draw_line(&p1, &p2, mask, style, opa_scale);

            /*Draw circle on the joints if enabled*/
            if(style->line.rounded) {
                circle_area.x1 = p1.x - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
                circle_area.y1 = p1.y - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
                circle_area.x2 = p1.x + ((style->line.width - 1) >> 1);
                circle_area.y2 = p1.y + ((style->line.width - 1) >> 1);
                lv_draw_rect(&circle_area, mask, &circle_style_tmp, opa_scale);
            }
        }

        /*Draw circle on the last point too if enabled*/
        if(style->line.rounded) {
            circle_area.x1 = p2.x - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
            circle_area.y1 = p2.y - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
            circle_area.x2 = p2.x + ((style->line.width - 1) >> 1);
            circle_area.y2 = p2.y + ((style->line.width - 1) >> 1);
            lv_draw_rect(&circle_area, mask, &circle_style_tmp, opa_scale);
        }
    }
    return true;
}

// Assembly:
cmpl $0x2, %edx
je 0xc9cf
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
testl %edx, %edx
jne 0xca24
movq %rsi, %rbx
movq %rdi, %r12
callq 0x6747
cmpw $0x0, 0x8(%rax)
je 0xc9d2
movq %rax, %r14
cmpq $0x0, (%rax)
je 0xc9d2
movq %r12, %rdi
callq 0x6316
movq %rax, %r15
movq %r12, %rdi
callq 0x6649
movb %al, 0xf(%rsp)
leaq 0x28(%rsp), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x50e5
movzwl (%rbp), %r13d
movzwl 0x2(%rbp), %eax
movl %eax, 0x1c(%rsp)
movq %r12, %rdi
callq 0x5332
movl %eax, 0x18(%rsp)
testb $0x1, 0x41(%r15)
je 0xc8d3
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x74d4
movw $0x7c18, 0x6(%rbp)      # imm = 0x7C18
movzwl 0x3c(%r15), %eax
movw %ax, 0x2(%rbp)
movw %ax, 0x4(%rbp)
movb 0x40(%r15), %al
movb %al, 0x8(%rbp)
movl 0x18(%rsp), %eax
addl 0x1c(%rsp), %eax
movl %eax, 0x18(%rsp)
xorl %r12d, %r12d
movzbl 0xf(%rsp), %ebp
movzwl %r12w, %r12d
movzwl 0x8(%r14), %eax
decl %eax
cmpl %r12d, %eax
jle 0xc9d6
movq (%r14), %rax
movl %r12d, %ecx
movzwl (%rax,%rcx,4), %edx
addw %r13w, %dx
movw %dx, 0x10(%rsp)
incl %r12d
movzwl (%rax,%r12,4), %edx
addw %r13w, %dx
movw %dx, 0x14(%rsp)
testb $0x2, 0xa(%r14)
movzwl 0x2(%rax,%rcx,4), %ecx
jne 0xc941
movl 0x1c(%rsp), %edx
addl %edx, %ecx
movw %cx, 0x12(%rsp)
movzwl 0x2(%rax,%r12,4), %ecx
addw %dx, %cx
jmp 0xc956
movl 0x18(%rsp), %esi
movl %esi, %edx
subl %ecx, %edx
movw %dx, 0x12(%rsp)
movl %esi, %ecx
subw 0x2(%rax,%r12,4), %cx
movw %cx, 0x16(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x14(%rsp), %rsi
movq %rbx, %rdx
movq %r15, %rcx
movl %ebp, %r8d
callq 0x37138
testb $0x1, 0x41(%r15)
je 0xc8e7
movzwl 0x10(%rsp), %eax
movswl 0x3e(%r15), %ecx
decl %ecx
movl %ecx, %edx
shrl %edx
andl $0x1, %ecx
addl %edx, %ecx
movl %eax, %esi
subl %ecx, %esi
movw %si, 0x20(%rsp)
movzwl 0x12(%rsp), %esi
addl %edx, %eax
addl %esi, %edx
subl %ecx, %esi
movw %si, 0x22(%rsp)
movw %ax, 0x24(%rsp)
movw %dx, 0x26(%rsp)
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
leaq 0x30(%rsp), %rdx
movl %ebp, %ecx
callq 0x336d4
jmp 0xc8e7
xorl %eax, %eax
retq
xorl %eax, %eax
jmp 0xca26
testb $0x1, 0x41(%r15)
je 0xca24
movzwl 0x14(%rsp), %eax
movswl 0x3e(%r15), %ecx
decl %ecx
movl %ecx, %edx
shrl %edx
andl $0x1, %ecx
addl %edx, %ecx
movl %eax, %esi
subl %ecx, %esi
leaq 0x20(%rsp), %rdi
movw %si, (%rdi)
movzwl 0x16(%rsp), %esi
addl %edx, %eax
addl %esi, %edx
subl %ecx, %esi
movw %si, 0x2(%rdi)
movw %ax, 0x4(%rdi)
movw %dx, 0x6(%rdi)
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
movl %ebp, %ecx
callq 0x336d4
movb $0x1, %al
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq