// File: /workspace/github_c_makefile_star2_O0/halcy[P]quasi_crystals_bot/Graphics/Bitmap.c
// Function: ScrollAndFillBitmap
void ScrollAndFillBitmap(Bitmap *self,int dx,int dy,Pixel c)
{
	if(dx==0 && dy==0) return;
	if(dx>=self->width || dx<=-self->width) { FillBitmap(self,c); return; }
	if(dy>=self->height || dy<=-self->height) { FillBitmap(self,c); return; }

	if(dy>0) for(int y=0;y<dy;y++) FillBitmapRow(self,y,c);

	if(dx==0)
	{
		if(dy<=0) memmove(BitmapPixelPointer(self,0,0),BitmapPixelPointer(self,0,-dy),(self->height+dy)*self->bytesperrow);
		else memmove(BitmapPixelPointer(self,0,dy),BitmapPixelPointer(self,0,0),(self->height-dy)*self->bytesperrow);
	}
	else
	{
		if(dy<=0) for(int y=0;y<self->height+dy;y++) ScrollAndFillBitmapRow(self,dx,y,y-dy,c);
		else for(int y=self->height-1;y>=dy;y--) ScrollAndFillBitmapRow(self,dx,y,y-dy,c);
	}

	if(dy<=0) for(int y=self->height+dy;y<self->height;y++) FillBitmapRow(self,y,c);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq -0x40(%rsp), %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
cmpl $0x0, -0xc(%rbp)
jne 0x8657
cmpl $0x0, -0x10(%rbp)
jne 0x8657
jmp 0x8849
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x8677
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl (%rcx), %edx
xorl %ecx, %ecx
subl %edx, %ecx
cmpl %ecx, %eax
jg 0x8688
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x8360
jmp 0x8849
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jge 0x86aa
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl 0x2(%rcx), %edx
xorl %ecx, %ecx
subl %edx, %ecx
cmpl %ecx, %eax
jg 0x86bb
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x8360
jmp 0x8849
cmpl $0x0, -0x10(%rbp)
jle 0x86ec
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x86ea
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x83b0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x86c8
jmp 0x86ec
cmpl $0x0, -0xc(%rbp)
jne 0x8787
cmpl $0x0, -0x10(%rbp)
jg 0x8741
movq -0x8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x82e0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
xorl %edx, %edx
subl -0x10(%rbp), %edx
xorl %esi, %esi
callq 0x82e0
movq -0x30(%rbp), %rdi
movq %rax, %rsi
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
addl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
imull 0x4(%rcx), %eax
movslq %eax, %rdx
callq 0x11b0
jmp 0x8782
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
xorl %esi, %esi
callq 0x82e0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x82e0
movq -0x38(%rbp), %rdi
movq %rax, %rsi
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
subl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
imull 0x4(%rcx), %eax
movslq %eax, %rdx
callq 0x11b0
jmp 0x880a
cmpl $0x0, -0x10(%rbp)
jg 0x87cc
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl 0x2(%rcx), %ecx
addl -0x10(%rbp), %ecx
cmpl %ecx, %eax
jge 0x87ca
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x1c(%rbp), %edx
movl -0x1c(%rbp), %ecx
subl -0x10(%rbp), %ecx
movl -0x14(%rbp), %r8d
callq 0x8850
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8794
jmp 0x8808
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x10(%rbp), %eax
jl 0x8806
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x20(%rbp), %ecx
subl -0x10(%rbp), %ecx
movl -0x14(%rbp), %r8d
callq 0x8850
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x87da
jmp 0x8808
jmp 0x880a
cmpl $0x0, -0x10(%rbp)
jg 0x8849
movq -0x8(%rbp), %rax
movswl 0x2(%rax), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movswl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jge 0x8847
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x83b0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x881e
jmp 0x8849
leaq 0x40(%rsp), %rsp
popq %rbp
retq