// File: /workspace/github_c_makefile_star2_O3/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, %r14d
subl %esi, %r14d
movl %edx, %r15d
subl %edi, %r15d
leaq 0x8b223(%rip), %rax     # 0xa4030
movl (%rax), %r12d
js 0x18e3a
cmpl %edi, %r12d
setle %al
testl %r10d, %r10d
sets %dl
orb %al, %dl
jne 0x19152
movl %esi, %r11d
movl %edi, %ebx
testl %edi, %edi
jns 0x18e7c
xorl %ebx, %ebx
cmpl %esi, %ecx
jne 0x18e63
movl %ecx, %r11d
jmp 0x18e7c
cmpl %r10d, %r12d
setle %al
testl %edi, %edi
sets %dl
orb %al, %dl
jne 0x19152
movl %r10d, %ebp
movl %ecx, %r9d
testl %r10d, %r10d
jns 0x18ecd
xorl %ebp, %ebp
cmpl %esi, %ecx
jne 0x18eb3
movl %ecx, %r9d
jmp 0x18ecd
movl %edi, %edx
negl %edx
movslq %r14d, %rax
imulq %rdx, %rax
movl %r15d, %r9d
cqto
idivq %r9
movq %rax, %r11
addl %esi, %r11d
cmpl %r10d, %r12d
jle 0x18e86
movl %r10d, %ebp
jmp 0x18eae
cmpl %esi, %ecx
je 0x18ea8
movl %r10d, %eax
notl %eax
addl %r12d, %eax
movslq %eax, %rdx
movslq %r14d, %rax
imulq %rdx, %rax
movl %r15d, %esi
cqto
idivq %rsi
addl %ecx, %eax
movl %eax, %ecx
decl %r12d
movl %r12d, %ebp
movl %ecx, %r9d
jmp 0x18f04
movl %r10d, %edx
negl %edx
movslq %r14d, %rax
imulq %rdx, %rax
movslq %r15d, %r9
cqto
idivq %r9
movq %rax, %r9
addl %ecx, %r9d
cmpl %edi, %r12d
jle 0x18ed9
movl %esi, %r11d
movl %edi, %ebx
jmp 0x18f04
cmpl %esi, %ecx
je 0x18efb
movl %edi, %eax
notl %eax
addl %r12d, %eax
movslq %eax, %rcx
movslq %r14d, %rax
imulq %rcx, %rax
movslq %r15d, %rcx
cqto
idivq %rcx
movq %rax, %rcx
addl %esi, %ecx
decl %r12d
movl %ecx, %r11d
movl %r12d, %ebx
movl 0x114e5e(%rip), %ecx    # 0x12dd68
testl %r14d, %r14d
js 0x18f7e
cmpl %ecx, %r11d
jge 0x19152
testl %r9d, %r9d
js 0x19152
testl %r11d, %r11d
jns 0x18f48
cmpl %edi, %r10d
je 0x18f3f
negl %r11d
movslq %r15d, %rax
imulq %r11, %rax
movl %r14d, %esi
cqto
idivq %rsi
addl %eax, %ebx
xorl %r11d, %r11d
testl %ebx, %ebx
cmovlel %r11d, %ebx
cmpl %ecx, %r9d
jl 0x18fe7
cmpl %edi, %r10d
je 0x18f70
notl %r9d
addl %ecx, %r9d
movslq %r9d, %rdx
movslq %r15d, %rax
imulq %rdx, %rax
movl %r14d, %esi
cqto
idivq %rsi
addl %eax, %ebp
decl %ecx
xorl %eax, %eax
testl %ebp, %ebp
cmovlel %eax, %ebp
movl %ecx, %r9d
jmp 0x18fe7
cmpl %ecx, %r9d
jge 0x19152
testl %r11d, %r11d
js 0x19152
testl %r9d, %r9d
jns 0x18fb7
cmpl %edi, %r10d
je 0x18fae
negl %r9d
movslq %r15d, %rax
imulq %r9, %rax
movslq %r14d, %rsi
cqto
idivq %rsi
addl %eax, %ebp
xorl %r9d, %r9d
testl %ebp, %ebp
cmovlel %r9d, %ebp
cmpl %ecx, %r11d
jl 0x18fe7
cmpl %edi, %r10d
je 0x18fdb
notl %r11d
addl %ecx, %r11d
movslq %r11d, %rdx
movslq %r15d, %rax
imulq %rdx, %rax
movslq %r14d, %rsi
cqto
idivq %rsi
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 0x190b5
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 0x114d39(%rip), %r11d   # 0x12dd6c
leaq 0x16524a(%rip), %rdi    # 0x17e284
movl (%rdi), %r9d
imull %r9d, %r11d
addl %ebx, %r11d
movslq %r11d, %r10
leaq 0x165062(%rip), %r11    # 0x17e0b0
addq (%r11), %r10
movl 0x8afc1(%rip), %ebx     # 0xa4018
leal 0x2(%rdx), %r11d
xorl %r14d, %r14d
leaq 0x8b74b(%rip), %r15     # 0xa47b0
xorl %ebp, %ebp
movl %r14d, %r12d
andl $0x1f, %r12d
testl %ebx, (%r15,%r12,4)
je 0x19080
movb %r8b, (%r10)
movl 0x8af9b(%rip), %ebx     # 0xa4018
movl (%rdi), %r9d
addl %eax, %ebp
cmpl %edx, %ebp
movl $0x0, %r12d
cmovgl %ecx, %r12d
movl $0x0, %r13d
cmovgq %rsi, %r13
subl %r12d, %ebp
movslq %r9d, %r12
addq %r12, %r10
addq %r13, %r10
decl %r11d
incl %r14d
cmpl $0x1, %r11d
jg 0x19067
jmp 0x19152
cmpl %ebx, %ebp
movl %r11d, %edi
cmovll %r9d, %edi
cmovll %r11d, %r9d
cmovll %ebp, %ebx
leaq 0x1651b8(%rip), %rdx    # 0x17e284
movl (%rdx), %r10d
movl %r10d, %edx
negl %edx
cmpl %edi, %r9d
cmovgl %r10d, %edx
addl 0x114c8b(%rip), %edi    # 0x12dd6c
imull %r10d, %edi
addl %ebx, %edi
movslq %edi, %rdi
leaq 0x164fbf(%rip), %r9     # 0x17e0b0
addq (%r9), %rdi
movl 0x8af1d(%rip), %r10d    # 0xa4018
leal 0x2(%rsi), %r9d
xorl %r11d, %r11d
leaq 0x8b6a7(%rip), %rbx     # 0xa47b0
xorl %ebp, %ebp
movl %r11d, %r14d
andl $0x1f, %r14d
testl %r10d, (%rbx,%r14,4)
je 0x19122
movb %r8b, (%rdi)
movl 0x8aef6(%rip), %r10d    # 0xa4018
addl %ecx, %ebp
cmpl %esi, %ebp
movl $0x0, %r14d
cmovgl %eax, %r14d
movl $0x0, %r15d
cmovgl %edx, %r15d
subl %r14d, %ebp
movslq %r15d, %r14
addq %r14, %rdi
incq %rdi
decl %r9d
incl %r11d
cmpl $0x1, %r9d
jg 0x1910b
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq