// File: /workspace/github_c_makefile_star2_O1/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:
movl %edx, %eax
orl %esi, %eax
je 0x5867
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r12d
movl %ecx, %ebx
movq %rdi, %r14
movzwl (%rdi), %eax
movzwl %ax, %eax
movswl %ax, %ecx
cmpl %esi, %ecx
setg %dl
negl %ecx
cmpl %esi, %ecx
setl %cl
testb %cl, %dl
movswl 0x2(%rdi), %r15d
je 0x5730
movl %r15d, %ecx
subl %ebp, %ecx
movl %r15d, %edx
setg %sil
negl %edx
cmpl %ebp, %edx
setl %dl
testb %dl, %sil
je 0x576c
testl %ebp, %ebp
jle 0x56ed
movq 0x8(%r14), %rdx
xorl %esi, %esi
testw %ax, %ax
jle 0x56e7
movl 0x4(%r14), %edi
imull %esi, %edi
movslq %edi, %rdi
addq %rdx, %rdi
movq %rax, %r8
movl %ebx, (%rdi)
leaq 0x4(%rdi), %rdi
decq %r8
jne 0x56dc
incl %esi
cmpl %ebp, %esi
jne 0x56c7
testl %r12d, %r12d
je 0x57a8
testl %ebp, %ebp
jle 0x57c7
cmpl %ebp, %r15d
jle 0x581d
movl %ebp, %r13d
notl %r13d
leal (%r13,%r15), %ecx
decl %r15d
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebx, %r8d
callq 0x5868
cmpl %ebp, %r15d
jg 0x570d
jmp 0x581d
testw %r15w, %r15w
jle 0x5858
movq 0x8(%r14), %rcx
xorl %edx, %edx
testw %ax, %ax
jle 0x5760
movl 0x4(%r14), %esi
imull %edx, %esi
movslq %esi, %rsi
addq %rcx, %rsi
movq %rax, %rdi
movl %ebx, (%rsi)
leaq 0x4(%rsi), %rsi
decq %rdi
jne 0x5755
incl %edx
cmpl %r15d, %edx
jne 0x5740
jmp 0x5858
testw %r15w, %r15w
jle 0x5858
movq 0x8(%r14), %rcx
xorl %edx, %edx
testw %ax, %ax
jle 0x579c
movl 0x4(%r14), %esi
imull %edx, %esi
movslq %esi, %rsi
addq %rcx, %rsi
movq %rax, %rdi
movl %ebx, (%rsi)
leaq 0x4(%rsi), %rsi
decq %rdi
jne 0x5791
incl %edx
cmpl %r15d, %edx
jne 0x577c
jmp 0x5858
movl 0x4(%r14), %edx
movl %edx, %eax
imull %ebp, %eax
testl %ebp, %ebp
movq 0x8(%r14), %rsi
jle 0x5801
imull %ecx, %edx
movslq %eax, %rdi
addq %rsi, %rdi
movslq %edx, %rdx
jmp 0x5818
movswl 0x2(%r14), %eax
addl %ebp, %eax
jle 0x581d
movl %ebp, %r13d
negl %r13d
xorl %r15d, %r15d
leal (%r13,%r15), %ecx
movq %r14, %rdi
movl %r12d, %esi
movl %r15d, %edx
movl %ebx, %r8d
callq 0x5868
movswl 0x2(%r14), %eax
leal 0x1(%r15), %r15d
addl %ebp, %eax
cmpl %eax, %r15d
jl 0x57d9
jmp 0x581d
addl %ebp, %r15d
imull %r15d, %edx
negl %eax
cltq
addq %rsi, %rax
movslq %edx, %rdx
movq %rsi, %rdi
movq %rax, %rsi
callq 0x11a0
testl %ebp, %ebp
jg 0x5858
jns 0x5858
movswl 0x2(%r14), %eax
addl %eax, %ebp
movzwl (%r14), %ecx
movq 0x8(%r14), %rdx
testw %cx, %cx
jle 0x5852
movl 0x4(%r14), %esi
imull %ebp, %esi
movslq %esi, %rsi
addq %rdx, %rsi
movq %rcx, %rdi
movl %ebx, (%rsi)
leaq 0x4(%rsi), %rsi
decq %rdi
jne 0x5847
incl %ebp
cmpl %eax, %ebp
jl 0x5832
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq