// File: /workspace/github_c_makefile_star2_O3/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 0xd45e
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
testl %edx, %edx
jne 0xd45a
movq %rsi, %rbx
movq %rdi, %r12
callq 0x6af7
cmpw $0x0, 0x8(%rax)
je 0xd461
movq %rax, %r14
cmpq $0x0, (%rax)
je 0xd461
movq %r12, %rdi
callq 0x66b6
movq %rax, %r15
movq %r12, %rdi
callq 0x69eb
movb %al, 0xf(%rsp)
leaq 0x28(%rsp), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x542b
movzwl (%rbp), %r13d
movzwl 0x2(%rbp), %eax
movl %eax, 0x1c(%rsp)
movq %r12, %rdi
callq 0x5697
movl %eax, 0x18(%rsp)
testb $0x1, 0x41(%r15)
je 0xd30e
leaq 0x30(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x799d
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)
cmpw $0x2, 0x8(%r14)
movzbl 0xf(%rsp), %ebp
jb 0xd40c
movl 0x18(%rsp), %eax
addl 0x1c(%rsp), %eax
movl %eax, 0x18(%rsp)
xorl %r12d, %r12d
movq (%r14), %rax
movzwl (%rax,%r12,4), %ecx
addw %r13w, %cx
movw %cx, 0x10(%rsp)
movzwl 0x4(%rax,%r12,4), %ecx
addw %r13w, %cx
movw %cx, 0x14(%rsp)
testb $0x2, 0xa(%r14)
movzwl 0x2(%rax,%r12,4), %ecx
jne 0xd371
movl 0x1c(%rsp), %edx
addl %edx, %ecx
movw %cx, 0x12(%rsp)
movzwl 0x6(%rax,%r12,4), %ecx
addw %dx, %cx
jmp 0xd386
movl 0x18(%rsp), %esi
movl %esi, %edx
subl %ecx, %edx
movw %dx, 0x12(%rsp)
movl %esi, %ecx
subw 0x6(%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 0x3ad34
testb $0x1, 0x41(%r15)
je 0xd3f6
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 0x36968
incq %r12
movzwl %r12w, %eax
movzwl 0x8(%r14), %ecx
decl %ecx
cmpl %eax, %ecx
jg 0xd32e
testb $0x1, 0x41(%r15)
je 0xd45a
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 0x36968
movb $0x1, %al
jmp 0xd463
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq