// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: yrbrend
static void yrbrend (int x, int y)
{
	int i, j, ox, oy, xx, yy, xxx, yyy, xxxend, yyyend, yv, cr=0, cb=0, *odc, *dc, *dc2;
	intptr_t p, pp;

	odc = dct[0]; dc2 = dct[10];
	for(yy=0;yy<(lcompvsamp[0]<<3);yy+=8)
	{
		oy = y+yy+globyoffs; if ((unsigned)oy >= (unsigned)clipydim) { odc += (lcomphsamp[0]<<6); continue; }
		pp = oy*bytesperline + ((x+globxoffs)<<2) + frameplace;
		for(xx=0;xx<(lcomphsamp[0]<<3);xx+=8,odc+=64)
		{
			ox = x+xx+globxoffs; if ((unsigned)ox >= (unsigned)clipxdim) continue;
			p = pp+(xx<<2);
			dc = odc;
			if (lnumcomponents > 1) dc2 = &dct[lcomphvsamp0][((yy>>lcompvsampshift0)<<3)+(xx>>lcomphsampshift0)];
			xxxend = min(clipxdim-ox,8);
			yyyend = min(clipydim-oy,8);
			if ((lcomphsamp[0] == 1) && (xxxend == 8))
			{
				for(yyy=0;yyy<yyyend;yyy++)
				{
					for(xxx=0;xxx<8;xxx++)
					{
						yv = dc[xxx];
						cr = (dc2[xxx+64]>>13)&~1;
						cb = (dc2[xxx   ]>>13)&~1;
						((int *)p)[xxx] = colclipup16[(unsigned)(yv+crmul[cr+2048]               )>>22]+
												  colclipup8[(unsigned)(yv+crmul[cr+2049]+cbmul[cb+2048])>>22]+
													  colclip[(unsigned)(yv+cbmul[cb+2049]               )>>22];
					}
					p += bytesperline;
					dc += 8;
					if (!((yyy+1)&(lcompvsamp[0]-1))) dc2 += 8;
				}
			}
			else if ((lcomphsamp[0] == 2) && (xxxend == 8))
			{
				for(yyy=0;yyy<yyyend;yyy++)
				{
					for(xxx=0;xxx<8;xxx+=2)
					{
						yv = dc[xxx];
						cr = (dc2[(xxx>>1)+64]>>13)&~1;
						cb = (dc2[(xxx>>1)   ]>>13)&~1;
						i = crmul[cr+2049]+cbmul[cb+2048];
						cr = crmul[cr+2048];
						cb = cbmul[cb+2049];
						((int *)p)[xxx] = colclipup16[(unsigned)(yv+cr)>>22]+
												  colclipup8[(unsigned)(yv+ i)>>22]+
													  colclip[(unsigned)(yv+cb)>>22];
						yv = dc[xxx+1];
						((int *)p)[xxx+1] = colclipup16[(unsigned)(yv+cr)>>22]+
													 colclipup8[(unsigned)(yv+ i)>>22]+
														 colclip[(unsigned)(yv+cb)>>22];
					}
					p += bytesperline;
					dc += 8;
					if (!((yyy+1)&(lcompvsamp[0]-1))) dc2 += 8;
				}
			}
			else
			{
				for(yyy=0;yyy<yyyend;yyy++)
				{
					i = 0; j = 1;
					for(xxx=0;xxx<xxxend;xxx++)
					{
						yv = dc[xxx];
						j--;
						if (!j)
						{
							j = lcomphsamp[0];
							cr = (dc2[i+64]>>13)&~1;
							cb = (dc2[i   ]>>13)&~1;
							i++;
						}
						((int *)p)[xxx] = colclipup16[(unsigned)(yv+crmul[cr+2048]               )>>22]+
												  colclipup8[(unsigned)(yv+crmul[cr+2049]+cbmul[cb+2048])>>22]+
													  colclip[(unsigned)(yv+cbmul[cb+2049]               )>>22];
					}
					p += bytesperline;
					dc += 8;
					if (!((yyy+1)&(lcompvsamp[0]-1))) dc2 += 8;
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, -0x28(%rsp)
movq %rdi, -0x18(%rsp)
movl 0x59737c(%rip), %edx    # 0x5e2210
leal (,%rdx,8), %eax
testl %eax, %eax
jle 0x4b3df
movq -0x28(%rsp), %rax
negl %eax
movl %eax, -0x44(%rsp)
xorl %ebp, %ebp
leaq 0x597399(%rip), %rax    # 0x5e2250
leaq 0x597d92(%rip), %rcx    # 0x5e2c50
leaq 0x59b0cb(%rip), %r10    # 0x5e5f90
leaq 0x59a0c4(%rip), %r14    # 0x5e4f90
leaq 0x59f0bd(%rip), %rbx    # 0x5e9f90
leaq 0x5990b6(%rip), %r15    # 0x5e3f90
movq %rax, -0x58(%rsp)
xorl %esi, %esi
xorl %edi, %edi
movq -0x28(%rsp), %rax
movq %rdi, -0x20(%rsp)
addl %eax, %edi
movl 0x585f2b(%rip), %eax    # 0x5d0e20
addl %eax, %edi
movl %edi, -0x40(%rsp)
cmpl 0x59733f(%rip), %edi    # 0x5e2240
jae 0x4b3aa
movl 0x5972f2(%rip), %r9d    # 0x5e2200
leal (,%r9,8), %edi
testl %edi, %edi
jle 0x4b3c3
movl 0x585eec(%rip), %edi    # 0x5d0e10
movl %edi, %r8d
imull -0x40(%rsp), %r8d
movl 0x585ee8(%rip), %r12d   # 0x5d0e1c
addl -0x18(%rsp), %r12d
leal (%r8,%r12,4), %r8d
movslq %r8d, %r8
addq 0x585ec1(%rip), %r8     # 0x5d0e08
movq %r8, -0x10(%rsp)
movl -0x44(%rsp), %r8d
subl %eax, %r8d
movl %r8d, -0x5c(%rsp)
xorl %r8d, %r8d
movq -0x18(%rsp), %rax
addl %r8d, %eax
addl 0x585eb2(%rip), %eax    # 0x5d0e1c
movl 0x5972cb(%rip), %r13d   # 0x5e223c
subl %eax, %r13d
movq %r8, -0x38(%rsp)
jbe 0x4b37c
cmpl $0x2, 0x59723a(%rip)    # 0x5e21c0
jl 0x4afc7
movb 0x5972a6(%rip), %cl     # 0x5e2234
movq -0x20(%rsp), %rax
shrl %cl, %eax
movslq 0x59729c(%rip), %r8     # 0x5e2238
movb 0x59728e(%rip), %cl     # 0x5e2230
movq -0x38(%rsp), %r12
shrl %cl, %r12d
leal (%r12,%rax,8), %eax
cltq
shlq $0x8, %r8
leaq 0x597295(%rip), %rcx    # 0x5e2250
addq %rcx, %r8
leaq (%r8,%rax,4), %rcx
movq -0x38(%rsp), %r8
leal (,%r8,4), %eax
cltq
addq -0x10(%rsp), %rax
cmpl $0x8, %r13d
movl $0x8, %r8d
cmovll %r13d, %r8d
movl 0x597255(%rip), %r12d   # 0x5e2240
movl %r12d, %r11d
subl -0x40(%rsp), %r12d
cmpl $0x1, %r9d
jne 0x4b0f8
cmpl $0x8, %r13d
jl 0x4b0f8
testl %r12d, %r12d
jle 0x4b37c
addl -0x5c(%rsp), %r11d
cmpl $0x8, %r11d
movl $0x8, %edx
cmovgel %edx, %r11d
cmpl $0x2, %r11d
movl $0x1, %edx
cmovll %edx, %r11d
movl %r11d, -0x60(%rsp)
xorl %r9d, %r9d
movq -0x58(%rsp), %r8
movl %r9d, -0x50(%rsp)
xorl %edx, %edx
leaq 0x597f46(%rip), %r9     # 0x5e2f90
movl (%r8,%rdx,4), %edi
movl (%rcx,%rdx,4), %ebp
movl 0x100(%rcx,%rdx,4), %esi
sarl $0xd, %esi
andl $-0x2, %esi
sarl $0xd, %ebp
andl $-0x2, %ebp
movslq %esi, %r12
movl 0x2000(%r10,%r12,4), %r13d
addl %edi, %r13d
shrl $0x16, %r13d
movl 0x2004(%r10,%r12,4), %r12d
addl %edi, %r12d
movslq %ebp, %r11
addl 0x2000(%rbx,%r11,4), %r12d
shrl $0x16, %r12d
movl (%r15,%r12,4), %r12d
addl (%r14,%r13,4), %r12d
addl 0x2004(%rbx,%r11,4), %edi
shrl $0x16, %edi
addl (%r9,%rdi,4), %r12d
movl %r12d, (%rax,%rdx,4)
incq %rdx
cmpq $0x8, %rdx
jne 0x4b04a
movslq 0x585d55(%rip), %rdi    # 0x5d0e10
addq %rdi, %rax
addq $0x20, %r8
movl -0x50(%rsp), %r9d
incl %r9d
movl 0x597140(%rip), %edx    # 0x5e2210
leal 0x7fffffff(%rdx), %r11d
xorl %r12d, %r12d
testl %r9d, %r11d
sete %r12b
shll $0x5, %r12d
addq %r12, %rcx
cmpl -0x60(%rsp), %r9d
jne 0x4b03c
jmp 0x4b37c
cmpl $0x2, %r9d
jne 0x4b238
cmpl $0x7, %r13d
jle 0x4b238
testl %r12d, %r12d
jle 0x4b37c
addl -0x5c(%rsp), %r11d
cmpl $0x8, %r11d
movl $0x8, %edx
cmovgel %edx, %r11d
cmpl $0x2, %r11d
movl $0x1, %edx
cmovll %edx, %r11d
movl %r11d, -0x60(%rsp)
xorl %r9d, %r9d
movq -0x58(%rsp), %r12
movl %r9d, -0x50(%rsp)
movq $-0x2, %rdx
leaq 0x597e3c(%rip), %r9     # 0x5e2f90
movl 0x8(%r12,%rdx,4), %r8d
movl 0x4(%rcx,%rdx,2), %esi
movl 0x104(%rcx,%rdx,2), %edi
sarl $0xd, %edi
andl $-0x2, %edi
sarl $0xd, %esi
andl $-0x2, %esi
movslq %edi, %r11
movslq %esi, %rsi
movl 0x2000(%rbx,%rsi,4), %edi
movl 0x2004(%rbx,%rsi,4), %ebp
addl 0x2004(%r10,%r11,4), %edi
movl 0x2000(%r10,%r11,4), %esi
leal (%rsi,%r8), %r11d
shrl $0x16, %r11d
leal (%rdi,%r8), %r13d
shrl $0x16, %r13d
movl (%r15,%r13,4), %r13d
addl (%r14,%r11,4), %r13d
addl %ebp, %r8d
shrl $0x16, %r8d
addl (%r9,%r8,4), %r13d
movl %r13d, 0x8(%rax,%rdx,4)
movl 0xc(%r12,%rdx,4), %r8d
leal (%r8,%rsi), %r11d
shrl $0x16, %r11d
addl %r8d, %edi
shrl $0x16, %edi
movl (%r15,%rdi,4), %edi
addl (%r14,%r11,4), %edi
addl %ebp, %r8d
shrl $0x16, %r8d
addl (%r9,%r8,4), %edi
movl %edi, 0xc(%rax,%rdx,4)
addq $0x2, %rdx
cmpq $0x6, %rdx
jb 0x4b154
movslq 0x585c15(%rip), %rdi    # 0x5d0e10
addq %rdi, %rax
addq $0x20, %r12
movl -0x50(%rsp), %r9d
incl %r9d
movl 0x597000(%rip), %edx    # 0x5e2210
leal 0x7fffffff(%rdx), %r8d
xorl %r11d, %r11d
testl %r9d, %r8d
sete %r11b
shll $0x5, %r11d
addq %r11, %rcx
cmpl -0x60(%rsp), %r9d
jne 0x4b141
jmp 0x4b37c
testl %r12d, %r12d
jle 0x4b37c
movslq %r8d, %r8
movq %r8, -0x8(%rsp)
addl -0x5c(%rsp), %r11d
cmpl $0x8, %r11d
movl $0x8, %r8d
cmovgel %r8d, %r11d
cmpl $0x2, %r11d
movl $0x1, %r8d
cmovll %r8d, %r11d
movl %r11d, -0x60(%rsp)
xorl %r11d, %r11d
movq -0x58(%rsp), %r8
movq %r8, -0x50(%rsp)
movl %r13d, -0x2c(%rsp)
movl %r11d, -0x3c(%rsp)
testl %r13d, %r13d
jle 0x4b345
movq %r15, %r13
movq %r14, %r15
movl $0x1, %edi
xorl %edx, %edx
xorl %r8d, %r8d
decl %edi
jne 0x4b2c7
movl 0x596f57(%rip), %edi    # 0x5e2200
movslq %r8d, %r8
movl (%rcx,%r8,4), %ebp
movl 0x100(%rcx,%r8,4), %esi
sarl $0xd, %esi
andl $-0x2, %esi
sarl $0xd, %ebp
andl $-0x2, %ebp
incl %r8d
movq -0x50(%rsp), %r9
movl (%r9,%rdx,4), %r11d
movslq %esi, %r9
movl 0x2000(%r10,%r9,4), %r12d
addl %r11d, %r12d
shrl $0x16, %r12d
movl 0x2004(%r10,%r9,4), %r9d
addl %r11d, %r9d
movslq %ebp, %r14
addl 0x2000(%rbx,%r14,4), %r9d
shrl $0x16, %r9d
movl (%r13,%r9,4), %r9d
addl (%r15,%r12,4), %r9d
addl 0x2004(%rbx,%r14,4), %r11d
shrl $0x16, %r11d
leaq 0x597c78(%rip), %r14    # 0x5e2f90
addl (%r14,%r11,4), %r9d
movl %r9d, (%rax,%rdx,4)
incq %rdx
cmpq -0x8(%rsp), %rdx
jl 0x4b29f
movl 0x585adc(%rip), %edi    # 0x5d0e10
movl 0x596ed6(%rip), %edx    # 0x5e2210
movq %r15, %r14
movq %r13, %r15
movl -0x2c(%rsp), %r13d
movl -0x3c(%rsp), %r11d
movslq %edi, %r8
addq %r8, %rax
addq $0x20, -0x50(%rsp)
incl %r11d
leal 0x7fffffff(%rdx), %r8d
xorl %r9d, %r9d
testl %r11d, %r8d
sete %r9b
shll $0x5, %r9d
addq %r9, %rcx
cmpl -0x60(%rsp), %r11d
jne 0x4b281
movq -0x38(%rsp), %r8
addq $0x8, %r8
addq $0x100, -0x58(%rsp)     # imm = 0x100
movl 0x596e6b(%rip), %r9d    # 0x5e2200
leal (,%r9,8), %eax
cltq
cmpq %rax, %r8
jl 0x4af5c
jmp 0x4b3c3
movl 0x596e50(%rip), %eax    # 0x5e2200
shll $0x6, %eax
cltq
movq -0x58(%rsp), %rdi
leaq (%rdi,%rax,4), %rdi
movq %rdi, -0x58(%rsp)
movq -0x20(%rsp), %rdi
addl $0x8, %edi
leal (,%rdx,8), %eax
addl $-0x8, -0x44(%rsp)
cmpl %eax, %edi
jl 0x4aee3
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop