// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
movl %edx, %r10d
movl %ecx, %r14d
subl %esi, %r14d
movl %edx, %r15d
subl %edi, %r15d
leaq 0x8a25f(%rip), %rax     # 0xa3030
movl (%rax), %r12d
js 0x18dfe
cmpl %edi, %r12d
setle %al
testl %r10d, %r10d
sets %dl
orb %al, %dl
jne 0x190ff
movl %esi, %r11d
movl %edi, %ebx
testl %edi, %edi
jns 0x18e40
xorl %ebx, %ebx
cmpl %esi, %ecx
jne 0x18e27
movl %esi, %r11d
jmp 0x18e40
cmpl %r10d, %r12d
setle %al
testl %edi, %edi
sets %dl
orb %al, %dl
jne 0x190ff
movl %r10d, %ebp
movl %ecx, %r9d
testl %r10d, %r10d
jns 0x18e91
xorl %ebp, %ebp
cmpl %esi, %ecx
jne 0x18e77
movl %ecx, %r9d
jmp 0x18e91
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 0x18e4a
movl %r10d, %ebp
jmp 0x18e72
cmpl %esi, %ecx
je 0x18e6c
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 0x18ec7
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 0x18e9d
movl %esi, %r11d
movl %edi, %ebx
jmp 0x18ec7
cmpl %esi, %ecx
je 0x18ebe
movl %edi, %eax
notl %eax
addl %r12d, %eax
movslq %eax, %rcx
movslq %r14d, %rax
imulq %rcx, %rax
movslq %r15d, %rcx
cqto
idivq %rcx
addl %esi, %eax
movl %eax, %esi
decl %r12d
movl %esi, %r11d
movl %r12d, %ebx
movl 0x113e9b(%rip), %ecx    # 0x12cd68
testl %r14d, %r14d
js 0x18f41
cmpl %ecx, %r11d
jge 0x190ff
testl %r9d, %r9d
js 0x190ff
testl %r11d, %r11d
jns 0x18f0b
cmpl %edi, %r10d
je 0x18f02
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 0x18faa
cmpl %edi, %r10d
je 0x18f33
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 0x18faa
cmpl %ecx, %r9d
jge 0x190ff
testl %r11d, %r11d
js 0x190ff
testl %r9d, %r9d
jns 0x18f7a
cmpl %edi, %r10d
je 0x18f71
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 0x18faa
cmpl %edi, %r10d
je 0x18f9e
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, %edx
negl %edx
cmovsl %eax, %edx
leal 0x1(%rdx), %eax
movl %r9d, %ecx
subl %r11d, %ecx
movl %ecx, %esi
negl %esi
cmovsl %ecx, %esi
leal 0x1(%rsi), %ecx
cmpl %esi, %edx
jae 0x1906d
cmpl %r11d, %r9d
cmovll %r9d, %r11d
movl %ebp, %edx
cmovll %ebx, %edx
cmovll %ebp, %ebx
xorl %edi, %edi
cmpl %ebx, %edx
setg %dil
leaq -0x1(,%rdi,2), %rdx
addl 0x113d76(%rip), %r11d   # 0x12cd6c
leaq 0x164287(%rip), %rdi    # 0x17d284
imull (%rdi), %r11d
addl %ebx, %r11d
movslq %r11d, %r9
leaq 0x1640a2(%rip), %r10    # 0x17d0b0
addq (%r10), %r9
leal 0x2(%rsi), %r10d
xorl %r11d, %r11d
leaq 0x8a791(%rip), %rbx     # 0xa37b0
xorl %ebp, %ebp
movl %r11d, %r14d
andl $0x1f, %r14d
movl (%rbx,%r14,4), %r14d
testl %r14d, 0x89fe5(%rip)    # 0xa3018
je 0x19038
movb %r8b, (%r9)
addl %eax, %ebp
cmpl %esi, %ebp
movl $0x0, %r14d
cmovgl %ecx, %r14d
movl $0x0, %r15d
cmovgq %rdx, %r15
subl %r14d, %ebp
addq %r9, %r15
movslq (%rdi), %r9
addq %r15, %r9
decl %r10d
incl %r11d
cmpl $0x1, %r10d
jg 0x19021
jmp 0x190ff
cmpl %ebx, %ebp
movl %r11d, %edi
cmovll %r9d, %edi
cmovll %r11d, %r9d
cmovll %ebp, %ebx
leaq 0x164200(%rip), %rsi    # 0x17d284
movl (%rsi), %r10d
movl %r10d, %esi
negl %esi
cmpl %edi, %r9d
cmovgl %r10d, %esi
addl 0x113cd3(%rip), %edi    # 0x12cd6c
imull %r10d, %edi
addl %ebx, %edi
movslq %edi, %rdi
leaq 0x164007(%rip), %r9     # 0x17d0b0
addq (%r9), %rdi
leal 0x2(%rdx), %r9d
xorl %r10d, %r10d
leaq 0x8a6f6(%rip), %r11     # 0xa37b0
xorl %ebx, %ebx
movl %r10d, %r14d
andl $0x1f, %r14d
movl (%r11,%r14,4), %ebp
testl %ebp, 0x89f4b(%rip)     # 0xa3018
je 0x190d2
movb %r8b, (%rdi)
addl %ecx, %ebx
cmpl %edx, %ebx
movl $0x0, %ebp
cmovgl %eax, %ebp
movl $0x0, %r14d
cmovgl %esi, %r14d
subl %ebp, %ebx
movslq %r14d, %r14
addq %r14, %rdi
incq %rdi
decl %r9d
incl %r10d
cmpl $0x1, %r9d
jg 0x190bc
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq