// File: /workspace/github_c_makefile_star2_O0/halcy[P]quasi_crystals_bot/Graphics/DrawingLines.c
// Function: GenericDrawLine
static inline void GenericDrawLine(Bitmap *bitmap,int x1,int y1,int x2,int y2,Pixel c,CompositionMode comp,
GenericDrawPixelFunction *pixelfunc,GenericDrawHorizontalLineFunction *hlinefunc,GenericDrawVerticalLineFunction *vlinefunc)
{
	if(x1==x2)
	{
		if(y1<y2) GenericDrawVerticalLine(bitmap,x1,y1,y2-y1+1,c,comp,vlinefunc);
		else GenericDrawVerticalLine(bitmap,x1,y2,y1-y2+1,c,comp,vlinefunc);
		return;
	}
	else if(y1==y2)
	{
		if(x1<x2) GenericDrawHorizontalLine(bitmap,x1,y1,x2-x1+1,c,comp,hlinefunc);
		else GenericDrawHorizontalLine(bitmap,x1,y2,x1-x2+1,c,comp,hlinefunc);
		return;
	}

	bool steep=abs(y2-y1)>abs(x2-x1);

	if(steep)
	{
		int t;
		t=x1; x1=y1; y1=t;
		t=x2; x2=y2; y2=t;
	}

	if(x1>x2)
	{
		int t;
		t=x1; x1=x2; x2=t;
		t=y1; y1=y2; y2=t;
	}

	int deltax=x2-x1;
	int deltay,ydir;
	if(y1<y2) { deltay=y2-y1; ydir=1; }
	else { deltay=y1-y2; ydir=-1; }

	int error=deltax>>1;
	int y=y1;

	if(steep)
	{
		for(int x=x1;x<=x2;x++)
		{
			GenericDrawPixel(bitmap,y,x,c,comp,pixelfunc);
			error-=deltay;
			if(error<0)
			{
				y+=ydir;
				error+=deltax;
			}
		}
	}
	else
	{
		for(int x=x1;x<=x2;x++)
		{
			GenericDrawPixel(bitmap,x,y,c,comp,pixelfunc);
			error-=deltay;
			if(error<0)
			{
				y+=ydir;
				error+=deltax;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq -0x50(%rsp), %rsp
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x9715
movl -0x10(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x96e8
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x18(%rbp), %ecx
subl -0x10(%rbp), %ecx
addl $0x1, %ecx
movl -0x1c(%rbp), %r8d
movq 0x10(%rbp), %r9
movq 0x28(%rbp), %rax
movq %rax, (%rsp)
callq 0x9e10
jmp 0x9710
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x10(%rbp), %ecx
subl -0x18(%rbp), %ecx
addl $0x1, %ecx
movl -0x1c(%rbp), %r8d
movq 0x10(%rbp), %r9
movq 0x28(%rbp), %rax
movq %rax, (%rsp)
callq 0x9e10
jmp 0x98f3
movl -0x10(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x977c
movl -0xc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x974f
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movl -0x14(%rbp), %ecx
subl -0xc(%rbp), %ecx
addl $0x1, %ecx
movl -0x1c(%rbp), %r8d
movq 0x10(%rbp), %r9
movq 0x20(%rbp), %rax
movq %rax, (%rsp)
callq 0x9e60
jmp 0x9777
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0xc(%rbp), %ecx
subl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl -0x1c(%rbp), %r8d
movq 0x10(%rbp), %r9
movq 0x20(%rbp), %rax
movq %rax, (%rsp)
callq 0x9e60
jmp 0x98f3
jmp 0x977e
movl -0x18(%rbp), %eax
subl -0x10(%rbp), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl -0x14(%rbp), %ecx
subl -0xc(%rbp), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
cmpl %ecx, %eax
setg %al
andb $0x1, %al
movb %al, -0x1d(%rbp)
testb $0x1, -0x1d(%rbp)
je 0x97cc
movl -0xc(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x97f8
movl -0xc(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
subl -0xc(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x981b
movl -0x18(%rbp), %eax
subl -0x10(%rbp), %eax
movl %eax, -0x30(%rbp)
movl $0x1, -0x34(%rbp)
jmp 0x982b
movl -0x10(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x30(%rbp)
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movl -0x2c(%rbp), %eax
sarl %eax
movl %eax, -0x38(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x3c(%rbp)
testb $0x1, -0x1d(%rbp)
je 0x9899
movl -0xc(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x9897
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
movl -0x40(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
callq 0x9eb0
movl -0x30(%rbp), %ecx
movl -0x38(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jge 0x988a
movl -0x34(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x2c(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x988c
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x9845
jmp 0x98f3
movl -0xc(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x98f1
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
movl -0x3c(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
callq 0x9eb0
movl -0x30(%rbp), %ecx
movl -0x38(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jge 0x98e4
movl -0x34(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x2c(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x98e6
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x989f
jmp 0x98f3
leaq 0x50(%rsp), %rsp
popq %rbp
retq
nopw (%rax,%rax)