// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %eax
orl %esi, %eax
je 0x5f6c
movzwl (%rdi), %eax
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %rbx
movswl 0x2(%rdi), %r14d
movzwl %ax, %eax
movswl %ax, %ecx
cmpl %esi, %ecx
setg %dl
negl %ecx
cmpl %esi, %ecx
setl %cl
testb %cl, %dl
je 0x5bcd
movl %r14d, %ecx
movl %r14d, %edx
subl %r15d, %ecx
setg %sil
negl %edx
cmpl %r15d, %edx
setl %dl
testb %dl, %sil
je 0x5ccf
testl %r15d, %r15d
jle 0x5b92
leaq -0x1(%rax), %rdi
leal 0x3(%rax), %esi
movq 0x8(%rbx), %rdx
movdqa 0x8864(%rip), %xmm2     # 0xe310
pmovsxbq 0x8bd1(%rip), %xmm1     # 0xe686
pmovsxbq 0x8bca(%rip), %xmm3     # 0xe688
pcmpeqd %xmm4, %xmm4
pmovsxbq 0x8bbf(%rip), %xmm5     # 0xe68a
movq %rdi, %xmm0
andl $0xfffc, %esi           # imm = 0xFFFC
addq $0xc, %rdx
xorl %edi, %edi
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
pxor %xmm2, %xmm0
testw %ax, %ax
jle 0x5b87
movl 0x4(%rbx), %r8d
movq %rsi, %r9
movdqa %xmm3, %xmm6
movdqa %xmm1, %xmm7
imull %edi, %r8d
movslq %r8d, %r8
addq %rdx, %r8
movdqa %xmm6, %xmm8
pxor %xmm2, %xmm8
pcmpgtq %xmm0, %xmm8
movd %xmm8, %r10d
notl %r10d
testb $0x1, %r10b
je 0x5b29
movl %ebp, -0xc(%r8)
pxor %xmm4, %xmm8
pextrb $0x8, %xmm8, %r10d
testb $0x1, %r10b
je 0x5b3f
movl %ebp, -0x8(%r8)
movdqa %xmm7, %xmm8
pxor %xmm2, %xmm8
pcmpgtq %xmm0, %xmm8
pxor %xmm4, %xmm8
pextrb $0x0, %xmm8, %r10d
testb $0x1, %r10b
je 0x5b65
movl %ebp, -0x4(%r8)
pextrb $0x8, %xmm8, %r10d
testb $0x1, %r10b
je 0x5b75
movl %ebp, (%r8)
addq $0x10, %r8
paddq %xmm5, %xmm6
paddq %xmm5, %xmm7
addq $-0x4, %r9
jne 0x5b07
incl %edi
cmpl %r15d, %edi
jne 0x5ae5
testl %r12d, %r12d
je 0x5dd1
testl %r15d, %r15d
jle 0x5e01
movl %r15d, %r13d
notl %r13d
leal (%r13,%r14), %ecx
decl %r14d
movq %rbx, %rdi
movl %r12d, %esi
movl %ebp, %r8d
movl %r14d, %edx
callq 0x5f7c
cmpl %r15d, %r14d
jg 0x5baa
jmp 0x5e35
testw %r14w, %r14w
jle 0x5f6c
leaq -0x1(%rax), %rsi
leal 0x3(%rax), %edx
movq 0x8(%rbx), %rcx
movdqa 0x8726(%rip), %xmm2     # 0xe310
pmovsxbq 0x8a93(%rip), %xmm1     # 0xe686
pmovsxbq 0x8a8c(%rip), %xmm3     # 0xe688
pcmpeqd %xmm4, %xmm4
pmovsxbq 0x8a81(%rip), %xmm5     # 0xe68a
movq %rsi, %xmm0
andl $0xfffc, %edx           # imm = 0xFFFC
addq $0xc, %rcx
xorl %esi, %esi
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
pxor %xmm2, %xmm0
testw %ax, %ax
jle 0x5cbf
movl 0x4(%rbx), %edi
movq %rdx, %r8
movdqa %xmm3, %xmm6
movdqa %xmm1, %xmm7
imull %esi, %edi
movslq %edi, %rdi
addq %rcx, %rdi
movdqa %xmm6, %xmm8
pxor %xmm2, %xmm8
pcmpgtq %xmm0, %xmm8
movd %xmm8, %r9d
notl %r9d
testb $0x1, %r9b
je 0x5c64
movl %ebp, -0xc(%rdi)
pxor %xmm4, %xmm8
pextrb $0x8, %xmm8, %r9d
testb $0x1, %r9b
je 0x5c79
movl %ebp, -0x8(%rdi)
movdqa %xmm7, %xmm8
pxor %xmm2, %xmm8
pcmpgtq %xmm0, %xmm8
pxor %xmm4, %xmm8
pextrb $0x0, %xmm8, %r9d
testb $0x1, %r9b
je 0x5c9e
movl %ebp, -0x4(%rdi)
pextrb $0x8, %xmm8, %r9d
testb $0x1, %r9b
je 0x5cad
movl %ebp, (%rdi)
addq $0x10, %rdi
paddq %xmm5, %xmm6
paddq %xmm5, %xmm7
addq $-0x4, %r8
jne 0x5c43
incl %esi
cmpl %r14d, %esi
jne 0x5c23
jmp 0x5f6c
testw %r14w, %r14w
jle 0x5f6c
leaq -0x1(%rax), %rsi
leal 0x3(%rax), %edx
movq 0x8(%rbx), %rcx
movdqa 0x8624(%rip), %xmm2     # 0xe310
pmovsxbq 0x8991(%rip), %xmm1     # 0xe686
pmovsxbq 0x898a(%rip), %xmm3     # 0xe688
pcmpeqd %xmm4, %xmm4
pmovsxbq 0x897f(%rip), %xmm5     # 0xe68a
movq %rsi, %xmm0
andl $0xfffc, %edx           # imm = 0xFFFC
addq $0xc, %rcx
xorl %esi, %esi
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
pxor %xmm2, %xmm0
testw %ax, %ax
jle 0x5dc1
movl 0x4(%rbx), %edi
movq %rdx, %r8
movdqa %xmm3, %xmm6
movdqa %xmm1, %xmm7
imull %esi, %edi
movslq %edi, %rdi
addq %rcx, %rdi
movdqa %xmm6, %xmm8
pxor %xmm2, %xmm8
pcmpgtq %xmm0, %xmm8
movd %xmm8, %r9d
notl %r9d
testb $0x1, %r9b
je 0x5d66
movl %ebp, -0xc(%rdi)
pxor %xmm4, %xmm8
pextrb $0x8, %xmm8, %r9d
testb $0x1, %r9b
je 0x5d7b
movl %ebp, -0x8(%rdi)
movdqa %xmm7, %xmm8
pxor %xmm2, %xmm8
pcmpgtq %xmm0, %xmm8
pxor %xmm4, %xmm8
pextrb $0x0, %xmm8, %r9d
testb $0x1, %r9b
je 0x5da0
movl %ebp, -0x4(%rdi)
pextrb $0x8, %xmm8, %r9d
testb $0x1, %r9b
je 0x5daf
movl %ebp, (%rdi)
addq $0x10, %rdi
paddq %xmm5, %xmm6
paddq %xmm5, %xmm7
addq $-0x4, %r8
jne 0x5d45
incl %esi
cmpl %r14d, %esi
jne 0x5d25
jmp 0x5f6c
testl %r15d, %r15d
jle 0x5e40
movl 0x4(%rbx), %eax
movq 0x8(%rbx), %rsi
imull %eax, %r15d
imull %eax, %ecx
movslq %r15d, %rdi
movslq %ecx, %rdx
addq %rsi, %rdi
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a0
addl %r15d, %r14d
jle 0x5e64
movl %r15d, %r13d
xorl %r14d, %r14d
negl %r13d
leal (%r13,%r14), %ecx
movq %rbx, %rdi
movl %r12d, %esi
movl %r14d, %edx
movl %ebp, %r8d
callq 0x5f7c
movswl 0x2(%rbx), %eax
leal 0x1(%r14), %r14d
addl %r15d, %eax
cmpl %eax, %r14d
jl 0x5e0f
testl %r15d, %r15d
jg 0x5f6c
jmp 0x5e64
movl 0x4(%rbx), %eax
addl %r15d, %r14d
movq 0x8(%rbx), %rdi
movl %eax, %ecx
imull %eax, %r14d
imull %r15d, %ecx
movslq %r14d, %rdx
negl %ecx
movslq %ecx, %rsi
addq %rdi, %rsi
callq 0x11a0
testl %r15d, %r15d
jns 0x5f6c
movzwl (%rbx), %ecx
movq 0x8(%rbx), %rdx
movswl 0x2(%rbx), %eax
movdqa 0x8490(%rip), %xmm2     # 0xe310
pmovsxbq 0x87fd(%rip), %xmm1     # 0xe686
pmovsxbq 0x87f6(%rip), %xmm3     # 0xe688
pcmpeqd %xmm4, %xmm4
pmovsxbq 0x87eb(%rip), %xmm5     # 0xe68a
leaq -0x1(%rcx), %rdi
movl %ecx, %esi
addl %eax, %r15d
addq $0xc, %rdx
movq %rdi, %xmm0
addl $0x3, %esi
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
andl $0xfffc, %esi           # imm = 0xFFFC
pxor %xmm2, %xmm0
testw %cx, %cx
jle 0x5f60
movl 0x4(%rbx), %edi
movq %rsi, %r8
movdqa %xmm3, %xmm6
movdqa %xmm1, %xmm7
imull %r15d, %edi
movslq %edi, %rdi
addq %rdx, %rdi
movdqa %xmm6, %xmm8
pxor %xmm2, %xmm8
pcmpgtq %xmm0, %xmm8
movd %xmm8, %r9d
notl %r9d
testb $0x1, %r9b
je 0x5f05
movl %ebp, -0xc(%rdi)
pxor %xmm4, %xmm8
pextrb $0x8, %xmm8, %r9d
testb $0x1, %r9b
je 0x5f1a
movl %ebp, -0x8(%rdi)
movdqa %xmm7, %xmm8
pxor %xmm2, %xmm8
pcmpgtq %xmm0, %xmm8
pxor %xmm4, %xmm8
pextrb $0x0, %xmm8, %r9d
testb $0x1, %r9b
je 0x5f3f
movl %ebp, -0x4(%rdi)
pextrb $0x8, %xmm8, %r9d
testb $0x1, %r9b
je 0x5f4e
movl %ebp, (%rdi)
addq $0x10, %rdi
paddq %xmm5, %xmm6
paddq %xmm5, %xmm7
addq $-0x4, %r8
jne 0x5ee4
incl %r15d
cmpl %eax, %r15d
jl 0x5ec3
leaq 0x8(%rsp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq