// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_line.c
// Function: lv_draw_line
void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * mask,
                  const lv_style_t * style, lv_opa_t opa_scale)
{

    if(style->line.width == 0) return;
    if(point1->x == point2->x && point1->y == point2->y) return;

    /*Return if the points are out of the mask*/
    if(point1->x < mask->x1 - style->line.width && point2->x < mask->x1 - style->line.width) return;
    if(point1->x > mask->x2 + style->line.width && point2->x > mask->x2 + style->line.width) return;
    if(point1->y < mask->y1 - style->line.width && point2->y < mask->y1 - style->line.width) return;
    if(point1->y > mask->y2 + style->line.width && point2->y > mask->y2 + style->line.width) return;

    line_draw_t main_line;
    lv_point_t p1;
    lv_point_t p2;

    /*If the line if rather vertical then be sure y1 < y2 else x1 < x2*/

    if(LV_MATH_ABS(point1->x - point2->x) > LV_MATH_ABS(point1->y - point2->y)) {

        /*Steps less in y then x -> rather horizontal*/
        if(point1->x < point2->x) {
            p1.x = point1->x;
            p1.y = point1->y;
            p2.x = point2->x;
            p2.y = point2->y;
        } else {
            p1.x = point2->x;
            p1.y = point2->y;
            p2.x = point1->x;
            p2.y = point1->y;
        }
    } else {
        /*Steps less in x then y -> rather vertical*/
        if(point1->y < point2->y) {
            p1.x = point1->x;
            p1.y = point1->y;
            p2.x = point2->x;
            p2.y = point2->y;
        } else {
            p1.x = point2->x;
            p1.y = point2->y;
            p2.x = point1->x;
            p2.y = point1->y;
        }
    }

    line_init(&main_line, &p1, &p2);

    /*Special case draw a horizontal line*/
    if(main_line.p1.y == main_line.p2.y) {
        line_draw_hor(&main_line, mask, style, opa_scale);
    }
    /*Special case draw a vertical line*/
    else if(main_line.p1.x == main_line.p2.x) {
        line_draw_ver(&main_line, mask, style, opa_scale);
    }
    /*Arbitrary skew line*/
    else {
        bool dir_ori = false;
#if LV_ANTIALIAS
        bool aa = lv_disp_get_antialiasing(lv_refr_get_disp_refreshing());
        if(aa) {
            lv_point_t p_tmp;

            if(main_line.hor) {
                if(main_line.p1.y < main_line.p2.y) {
                    dir_ori = true;
                    p_tmp.x = main_line.p2.x;
                    p_tmp.y = main_line.p2.y - 1;
                    line_init(&main_line, &p1, &p_tmp);
                    main_line.sy = LV_MATH_ABS(main_line.sy); /*The sign can change if the line becomes horizontal*/
                } else if(main_line.p1.y > main_line.p2.y) {
                    dir_ori = false;
                    p_tmp.x = main_line.p2.x;
                    p_tmp.y = main_line.p2.y + 1;
                    line_init(&main_line, &p1, &p_tmp);
                    main_line.sy = -LV_MATH_ABS(main_line.sy); /*The sign can change if the line becomes horizontal*/
                }
            } else {
                if(main_line.p1.x < main_line.p2.x) {
                    dir_ori = true;
                    p_tmp.x = main_line.p2.x - 1;
                    p_tmp.y = main_line.p2.y;
                    line_init(&main_line, &p1, &p_tmp);
                    main_line.sx = LV_MATH_ABS(main_line.sx); /*The sign can change if the line becomes vertical*/
                } else if(main_line.p1.x > main_line.p2.x) {
                    dir_ori = false;
                    p_tmp.x = main_line.p2.x + 1;
                    p_tmp.y = main_line.p2.y;
                    line_init(&main_line, &p1, &p_tmp);
                    main_line.sx = -LV_MATH_ABS(main_line.sx); /*The sign can change if the line becomes vertical*/
                }
            }
        }
#endif
        line_draw_skew(&main_line, dir_ori, mask, style, opa_scale);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movq -0x20(%rbp), %rax
movswl 0x3e(%rax), %eax
cmpl $0x0, %eax
jne 0x5fd00
jmp 0x601c7
movq -0x8(%rbp), %rax
movswl (%rax), %eax
movq -0x10(%rbp), %rcx
movswl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x5fd2b
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
movq -0x10(%rbp), %rcx
movswl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jne 0x5fd2b
jmp 0x601c7
movq -0x8(%rbp), %rax
movswl (%rax), %eax
movq -0x18(%rbp), %rcx
movswl (%rcx), %ecx
movq -0x20(%rbp), %rdx
movswl 0x3e(%rdx), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jge 0x5fd68
movq -0x10(%rbp), %rax
movswl (%rax), %eax
movq -0x18(%rbp), %rcx
movswl (%rcx), %ecx
movq -0x20(%rbp), %rdx
movswl 0x3e(%rdx), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jge 0x5fd68
jmp 0x601c7
movq -0x8(%rbp), %rax
movswl (%rax), %eax
movq -0x18(%rbp), %rcx
movswl 0x4(%rcx), %ecx
movq -0x20(%rbp), %rdx
movswl 0x3e(%rdx), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jle 0x5fda7
movq -0x10(%rbp), %rax
movswl (%rax), %eax
movq -0x18(%rbp), %rcx
movswl 0x4(%rcx), %ecx
movq -0x20(%rbp), %rdx
movswl 0x3e(%rdx), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jle 0x5fda7
jmp 0x601c7
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
movq -0x18(%rbp), %rcx
movswl 0x2(%rcx), %ecx
movq -0x20(%rbp), %rdx
movswl 0x3e(%rdx), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jge 0x5fde8
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
movq -0x18(%rbp), %rcx
movswl 0x2(%rcx), %ecx
movq -0x20(%rbp), %rdx
movswl 0x3e(%rdx), %edx
subl %edx, %ecx
cmpl %ecx, %eax
jge 0x5fde8
jmp 0x601c7
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
movq -0x18(%rbp), %rcx
movswl 0x6(%rcx), %ecx
movq -0x20(%rbp), %rdx
movswl 0x3e(%rdx), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jle 0x5fe29
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
movq -0x18(%rbp), %rcx
movswl 0x6(%rcx), %ecx
movq -0x20(%rbp), %rdx
movswl 0x3e(%rdx), %edx
addl %edx, %ecx
cmpl %ecx, %eax
jle 0x5fe29
jmp 0x601c7
movq -0x8(%rbp), %rax
movswl (%rax), %eax
movq -0x10(%rbp), %rcx
movswl (%rcx), %ecx
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x5fe53
movq -0x8(%rbp), %rax
movswl (%rax), %eax
movq -0x10(%rbp), %rcx
movswl (%rcx), %ecx
subl %ecx, %eax
movl %eax, -0x50(%rbp)
jmp 0x5fe6a
movq -0x8(%rbp), %rax
movswl (%rax), %ecx
movq -0x10(%rbp), %rax
movswl (%rax), %eax
subl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
movq -0x10(%rbp), %rcx
movswl 0x2(%rcx), %ecx
subl %ecx, %eax
cmpl $0x0, %eax
jle 0x5fe9e
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
movq -0x10(%rbp), %rcx
movswl 0x2(%rcx), %ecx
subl %ecx, %eax
movl %eax, -0x58(%rbp)
jmp 0x5feb7
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %ecx
movq -0x10(%rbp), %rax
movswl 0x2(%rax), %eax
subl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %eax
movl -0x58(%rbp), %ecx
cmpl %ecx, %eax
jle 0x5ff33
movq -0x8(%rbp), %rax
movswl (%rax), %eax
movq -0x10(%rbp), %rcx
movswl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x5ff03
movq -0x8(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x3e(%rbp)
movq -0x10(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x42(%rbp)
jmp 0x5ff31
movq -0x10(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x3e(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x42(%rbp)
jmp 0x5ffa7
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
movq -0x10(%rbp), %rcx
movswl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jge 0x5ff77
movq -0x8(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x3e(%rbp)
movq -0x10(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x42(%rbp)
jmp 0x5ffa5
movq -0x10(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x3e(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x42(%rbp)
jmp 0x5ffa7
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x44(%rbp), %rdx
callq 0x601d0
movswl -0x3a(%rbp), %eax
movswl -0x36(%rbp), %ecx
cmpl %ecx, %eax
jne 0x5ffde
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x3c(%rbp), %rdi
movzbl -0x21(%rbp), %ecx
callq 0x603c0
jmp 0x601c7
movswl -0x3c(%rbp), %eax
movswl -0x38(%rbp), %ecx
cmpl %ecx, %eax
jne 0x60004
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x3c(%rbp), %rdi
movzbl -0x21(%rbp), %ecx
callq 0x60530
jmp 0x601c5
movb $0x0, -0x45(%rbp)
callq 0xafe0
movq %rax, %rdi
callq 0xdb00
andb $0x1, %al
movb %al, -0x46(%rbp)
testb $0x1, -0x46(%rbp)
je 0x601a7
testb $0x1, -0x24(%rbp)
je 0x600eb
movswl -0x3a(%rbp), %eax
movswl -0x36(%rbp), %ecx
cmpl %ecx, %eax
jge 0x60088
movb $0x1, -0x45(%rbp)
movw -0x38(%rbp), %ax
movw %ax, -0x4a(%rbp)
movswl -0x36(%rbp), %eax
subl $0x1, %eax
movw %ax, -0x48(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x4a(%rbp), %rdx
callq 0x601d0
movswl -0x2a(%rbp), %eax
cmpl $0x0, %eax
jle 0x60074
movswl -0x2a(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0x6007f
movswl -0x2a(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movw %ax, -0x2a(%rbp)
jmp 0x600e6
movswl -0x3a(%rbp), %eax
movswl -0x36(%rbp), %ecx
cmpl %ecx, %eax
jle 0x600e4
movb $0x0, -0x45(%rbp)
movw -0x38(%rbp), %ax
movw %ax, -0x4a(%rbp)
movswl -0x36(%rbp), %eax
addl $0x1, %eax
movw %ax, -0x48(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x4a(%rbp), %rdx
callq 0x601d0
movswl -0x2a(%rbp), %eax
cmpl $0x0, %eax
jle 0x600ce
movswl -0x2a(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0x600d9
movswl -0x2a(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movw %ax, -0x2a(%rbp)
jmp 0x600e6
jmp 0x601a5
movswl -0x3c(%rbp), %eax
movswl -0x38(%rbp), %ecx
cmpl %ecx, %eax
jge 0x60145
movb $0x1, -0x45(%rbp)
movswl -0x38(%rbp), %eax
subl $0x1, %eax
movw %ax, -0x4a(%rbp)
movw -0x36(%rbp), %ax
movw %ax, -0x48(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x4a(%rbp), %rdx
callq 0x601d0
movswl -0x2e(%rbp), %eax
cmpl $0x0, %eax
jle 0x60131
movswl -0x2e(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0x6013c
movswl -0x2e(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movw %ax, -0x2e(%rbp)
jmp 0x601a3
movswl -0x3c(%rbp), %eax
movswl -0x38(%rbp), %ecx
cmpl %ecx, %eax
jle 0x601a1
movb $0x0, -0x45(%rbp)
movswl -0x38(%rbp), %eax
addl $0x1, %eax
movw %ax, -0x4a(%rbp)
movw -0x36(%rbp), %ax
movw %ax, -0x48(%rbp)
leaq -0x3c(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x4a(%rbp), %rdx
callq 0x601d0
movswl -0x2e(%rbp), %eax
cmpl $0x0, %eax
jle 0x6018b
movswl -0x2e(%rbp), %eax
movl %eax, -0x68(%rbp)
jmp 0x60196
movswl -0x2e(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %ecx
xorl %eax, %eax
subl %ecx, %eax
movw %ax, -0x2e(%rbp)
jmp 0x601a3
jmp 0x601a5
jmp 0x601a7
movb -0x45(%rbp), %al
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq -0x3c(%rbp), %rdi
andb $0x1, %al
movzbl %al, %esi
movzbl -0x21(%rbp), %r8d
callq 0x606a0
jmp 0x601c7
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)