// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/jfbuild/src/build.c
// Function: drawline16
void drawline16(int x1, int y1, int x2, int y2, unsigned char col)
{
	int i, dx, dy, pinc, d;
	intptr_t p;
	unsigned int patc=0;

	dx = x2-x1; dy = y2-y1;
	if (dx >= 0)
	{
		if ((x1 >= xres) || (x2 < 0)) return;
		if (x1 < 0) { if (dy) y1 += scale(0-x1,dy,dx); x1 = 0; }
		if (x2 >= xres) { if (dy) y2 += scale(xres-1-x2,dy,dx); x2 = xres-1; }
	}
	else
	{
		if ((x2 >= xres) || (x1 < 0)) return;
		if (x2 < 0) { if (dy) y2 += scale(0-x2,dy,dx); x2 = 0; }
		if (x1 >= xres) { if (dy) y1 += scale(xres-1-x1,dy,dx); x1 = xres-1; }
	}
	if (dy >= 0)
	{
		if ((y1 >= ydim16) || (y2 < 0)) return;
		if (y1 < 0) { if (dx) x1 += scale(0-y1,dx,dy); y1 = 0; if (x1 < 0) x1 = 0; }
		if (y2 >= ydim16) { if (dx) x2 += scale(ydim16-1-y2,dx,dy); y2 = ydim16-1; if (x2 < 0) x2 = 0; }
	}
	else
	{
		if ((y2 >= ydim16) || (y1 < 0)) return;
		if (y2 < 0) { if (dx) x2 += scale(0-y2,dx,dy); y2 = 0; if (x2 < 0) x2 = 0; }
		if (y1 >= ydim16) { if (dx) x1 += scale(ydim16-1-y1,dx,dy); y1 = ydim16-1; if (x1 < 0) x1 = 0; }
	}

	dx = klabs(x2-x1)+1; dy = klabs(y2-y1)+1;
	if (dx >= dy)
	{
		if (x2 < x1)
		{
			i = x1; x1 = x2; x2 = i;
			i = y1; y1 = y2; y2 = i;
		}
		d = 0;
		if (y2 > y1) pinc = bytesperline; else pinc = -bytesperline;

		p = ((ytop16+y1)*bytesperline)+x1+frameplace;
		if (dy == 0 && drawlinepat == 0xffffffff) {
			i = ((int)col<<24)|((int)col<<16)|((int)col<<8)|col;
			clearbufbyte((void *)p, dx, i);
		} else
		for(i=dx;i>0;i--)
		{
			if (drawlinepat & pow2long[(patc++)&31])
				drawpixel((void *)p, col);
			d += dy;
			if (d >= dx) { d -= dx; p += pinc; }
			p++;
		}
		return;
	}

	if (y2 < y1)
	{
		i = x1; x1 = x2; x2 = i;
		i = y1; y1 = y2; y2 = i;
	}
	d = 0;
	if (x2 > x1) pinc = 1; else pinc = -1;

	p = ((ytop16+y1)*bytesperline)+x1+frameplace;
	for(i=dy;i>0;i--)
	{
		if (drawlinepat & pow2long[(patc++)&31])
			drawpixel((void *)p, col);
		d += dx;
		if (d >= dy) { d -= dy; p += pinc; }
		p += bytesperline;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %r10d
movl %ecx, %r12d
subl %esi, %r12d
movl %edx, %eax
subl %edi, %eax
leaq 0x85c93(%rip), %rdx     # 0x9d030
movl (%rdx), %r13d
movslq %eax, %r14
movslq %r12d, %r15
js 0x173d5
cmpl %edi, %r13d
setle %dl
testl %r10d, %r10d
sets %r9b
orb %dl, %r9b
jne 0x176b5
movl %eax, %r9d
movl %esi, %r11d
movl %edi, %ebx
testl %edi, %edi
jns 0x17411
xorl %ebx, %ebx
cmpl %esi, %ecx
jne 0x173fe
movl %ecx, %r11d
jmp 0x17411
cmpl %r10d, %r13d
setle %al
testl %edi, %edi
sets %dl
orb %al, %dl
jne 0x176b5
movl %r10d, %ebp
movl %ecx, %r9d
testl %r10d, %r10d
jns 0x17455
xorl %ebp, %ebp
cmpl %esi, %ecx
jne 0x17441
movl %ecx, %r9d
jmp 0x17455
movl %edi, %eax
negl %eax
imulq %r15, %rax
cqto
idivq %r9
movq %rax, %r11
addl %esi, %r11d
cmpl %r10d, %r13d
jle 0x1741b
movl %r10d, %ebp
jmp 0x1743c
cmpl %esi, %ecx
je 0x17436
movl %r10d, %eax
notl %eax
addl %r13d, %eax
cltq
imulq %r15, %rax
cqto
idivq %r9
addl %ecx, %eax
movl %eax, %ecx
decl %r13d
movl %r13d, %ebp
movl %ecx, %r9d
jmp 0x17485
movl %r10d, %eax
negl %eax
imulq %r15, %rax
cqto
idivq %r14
movq %rax, %r9
addl %ecx, %r9d
cmpl %edi, %r13d
jle 0x17461
movl %esi, %r11d
movl %edi, %ebx
jmp 0x17485
cmpl %esi, %ecx
je 0x1747c
movl %edi, %eax
notl %eax
addl %r13d, %eax
cltq
imulq %r15, %rax
cqto
idivq %r14
movq %rax, %rcx
addl %esi, %ecx
decl %r13d
movl %ecx, %r11d
movl %r13d, %ebx
movl 0x10f8dd(%rip), %ecx    # 0x126d68
testl %r12d, %r12d
js 0x174f9
cmpl %ecx, %r11d
jge 0x176b5
testl %r9d, %r9d
js 0x176b5
movl %r12d, %esi
testl %r11d, %r11d
jns 0x174c9
cmpl %edi, %r10d
je 0x174c0
negl %r11d
imulq %r14, %r11
movq %r11, %rax
cqto
idivq %rsi
addl %eax, %ebx
xorl %r11d, %r11d
testl %ebx, %ebx
cmovlel %r11d, %ebx
cmpl %ecx, %r9d
jl 0x17559
cmpl %edi, %r10d
je 0x174eb
notl %r9d
addl %ecx, %r9d
movslq %r9d, %rax
imulq %r14, %rax
cqto
idivq %rsi
addl %eax, %ebp
decl %ecx
xorl %eax, %eax
testl %ebp, %ebp
cmovlel %eax, %ebp
movl %ecx, %r9d
jmp 0x17559
cmpl %ecx, %r9d
jge 0x176b5
testl %r11d, %r11d
js 0x176b5
testl %r9d, %r9d
jns 0x1752f
cmpl %edi, %r10d
je 0x17526
negl %r9d
imulq %r14, %r9
movq %r9, %rax
cqto
idivq %r15
addl %eax, %ebp
xorl %r9d, %r9d
testl %ebp, %ebp
cmovlel %r9d, %ebp
cmpl %ecx, %r11d
jl 0x17559
cmpl %edi, %r10d
je 0x1754d
notl %r11d
addl %ecx, %r11d
movslq %r11d, %rax
imulq %r14, %rax
cqto
idivq %r15
addl %eax, %ebx
decl %ecx
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %ebx
movl %ecx, %r11d
movl %ebp, %eax
subl %ebx, %eax
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
leal 0x1(%rsi), %eax
movl %r9d, %ecx
subl %r11d, %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
leal 0x1(%rdx), %ecx
cmpl %edx, %esi
jae 0x17621
cmpl %r11d, %r9d
cmovll %r9d, %r11d
movl %ebp, %esi
cmovll %ebx, %esi
cmovll %ebp, %ebx
xorl %edi, %edi
cmpl %ebx, %esi
setg %dil
leaq -0x1(,%rdi,2), %rsi
addl 0x10f7c7(%rip), %r11d   # 0x126d6c
leaq 0x15fcd8(%rip), %rdi    # 0x177284
movl (%rdi), %r9d
imull %r9d, %r11d
addl %ebx, %r11d
movslq %r11d, %r10
leaq 0x15faf0(%rip), %r11    # 0x1770b0
addq (%r11), %r10
xorl %r11d, %r11d
leaq 0x861e3(%rip), %rbx     # 0x9d7b0
movl %ecx, %ebp
xorl %r14d, %r14d
testl %ebp, %ebp
jle 0x176b5
movl %r14d, %r15d
andl $0x1f, %r15d
movl (%rbx,%r15,4), %r15d
testl %r15d, 0x85a2c(%rip)    # 0x9d018
je 0x175f4
movb %r8b, (%r10)
movl (%rdi), %r9d
addl %eax, %r11d
cmpl %edx, %r11d
movl $0x0, %r15d
cmovgl %ecx, %r15d
movl $0x0, %r12d
cmovgq %rsi, %r12
subl %r15d, %r11d
movslq %r9d, %r15
addq %r15, %r10
addq %r12, %r10
decl %ebp
incl %r14d
jmp 0x175d2
cmpl %ebx, %ebp
movl %r11d, %edi
cmovll %r9d, %edi
cmovll %r11d, %r9d
cmovll %ebp, %ebx
leaq 0x15fc4c(%rip), %rdx    # 0x177284
movl (%rdx), %r10d
movl %r10d, %edx
negl %edx
cmpl %edi, %r9d
cmovgl %r10d, %edx
addl 0x10f71f(%rip), %edi    # 0x126d6c
imull %r10d, %edi
addl %ebx, %edi
movslq %edi, %rdi
leaq 0x15fa53(%rip), %r9     # 0x1770b0
addq (%r9), %rdi
xorl %r9d, %r9d
leaq 0x86146(%rip), %r10     # 0x9d7b0
movl %eax, %r11d
xorl %ebx, %ebx
testl %r11d, %r11d
jle 0x176b5
movl %ebx, %r14d
andl $0x1f, %r14d
movl (%r10,%r14,4), %ebp
testl %ebp, 0x85993(%rip)     # 0x9d018
je 0x1768a
movb %r8b, (%rdi)
addl %ecx, %r9d
cmpl %esi, %r9d
movl $0x0, %ebp
cmovgl %eax, %ebp
movl $0x0, %r14d
cmovgl %edx, %r14d
subl %ebp, %r9d
movslq %r14d, %r14
addq %r14, %rdi
incq %rdi
decl %r11d
incl %ebx
jmp 0x1766f
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq