// File: /workspace/github_c_makefile_star2_O2/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 %rdi, -0x20(%rsp)
movq %rsi, %rax
movq %rsi, -0x10(%rsp)
negl %eax
movl %eax, -0x44(%rsp)
leaq 0x5995cc(%rip), %rcx    # 0x5dbc50
leaq 0x598bc5(%rip), %rsi    # 0x5db250
xorl %edi, %edi
movl 0x598b7d(%rip), %eax    # 0x5db210
leaq 0x59c8f6(%rip), %r10    # 0x5def90
leaq 0x5a08ef(%rip), %rbx    # 0x5e2f90
leaq 0x5998e8(%rip), %r15    # 0x5dbf90
xorl %edx, %edx
xorl %r13d, %r13d
movq %rsi, -0x50(%rsp)
leal (,%rax,8), %esi
cmpl %esi, %edi
jge 0x42b4c
movq -0x10(%rsp), %rsi
movq %rdi, -0x28(%rsp)
addl %esi, %edi
movl 0x58774d(%rip), %esi    # 0x5c9e20
addl %esi, %edi
cmpl 0x598b65(%rip), %edi    # 0x5db240
jae 0x42b20
imull 0x587728(%rip), %edi    # 0x5c9e10
movl 0x58772d(%rip), %r8d    # 0x5c9e1c
addl -0x20(%rsp), %r8d
leal (%rdi,%r8,4), %edi
movslq %edi, %rdi
addq 0x587706(%rip), %rdi    # 0x5c9e08
movq %rdi, -0x8(%rsp)
movl -0x44(%rsp), %edi
subl %esi, %edi
movl %edi, -0x54(%rsp)
xorl %r8d, %r8d
movl 0x598ae6(%rip), %esi    # 0x5db200
leal (,%rsi,8), %edi
movslq %edi, %rdi
cmpq %rdi, %r8
jge 0x42b3a
movq -0x20(%rsp), %rdi
movq %r8, -0x38(%rsp)
addl %edi, %r8d
addl 0x5876db(%rip), %r8d    # 0x5c9e1c
movl 0x598af5(%rip), %edi    # 0x5db23c
subl %r8d, %edi
jbe 0x42b09
cmpl $0x2, 0x598a69(%rip)    # 0x5db1c0
jl 0x42795
movb 0x598ad5(%rip), %cl     # 0x5db234
movq -0x28(%rsp), %r8
shrl %cl, %r8d
movslq 0x598aca(%rip), %r9     # 0x5db238
movb 0x598abc(%rip), %cl     # 0x5db230
movq -0x38(%rsp), %r12
shrl %cl, %r12d
leal (%r12,%r8,8), %ecx
movslq %ecx, %rcx
shlq $0x8, %r9
leaq 0x598ac2(%rip), %r8     # 0x5db250
addq %r8, %r9
leaq (%r9,%rcx,4), %rcx
movq -0x38(%rsp), %r8
leal (,%r8,4), %r8d
movslq %r8d, %r8
addq -0x8(%rsp), %r8
cmpl $0x8, %edi
movl $0x8, %r9d
cmovll %edi, %r9d
movl 0x598a83(%rip), %ebp    # 0x5db240
cmpl $0x1, %esi
jne 0x428a8
cmpl $0x8, %edi
jl 0x428a8
addl -0x54(%rsp), %ebp
cmpl $0x8, %ebp
movl $0x8, %esi
cmovgel %esi, %ebp
xorl %r11d, %r11d
testl %ebp, %ebp
cmovlel %r11d, %ebp
movl %ebp, -0x58(%rsp)
movq -0x50(%rsp), %r12
cmpl -0x58(%rsp), %r11d
je 0x42b09
xorl %eax, %eax
cmpq $0x8, %rax
je 0x42877
movl (%r12,%rax,4), %esi
movl (%rcx,%rax,4), %r13d
movl 0x100(%rcx,%rax,4), %edx
sarl $0xd, %edx
andl $-0x2, %edx
sarl $0xd, %r13d
andl $-0x2, %r13d
movslq %edx, %r9
movl 0x2000(%r10,%r9,4), %ebp
addl %esi, %ebp
shrl $0x16, %ebp
movl 0x2004(%r10,%r9,4), %r9d
addl %esi, %r9d
movslq %r13d, %rdi
addl 0x2000(%rbx,%rdi,4), %r9d
shrl $0x16, %r9d
leaq 0x59a73f(%rip), %r14    # 0x5dcf90
movl (%r14,%r9,4), %r9d
leaq 0x59b734(%rip), %r14    # 0x5ddf90
addl (%r14,%rbp,4), %r9d
addl 0x2004(%rbx,%rdi,4), %esi
shrl $0x16, %esi
addl (%r15,%rsi,4), %r9d
movl %r9d, (%r8,%rax,4)
incq %rax
jmp 0x427fd
movslq 0x587592(%rip), %rax    # 0x5c9e10
addq %rax, %r8
addq $0x20, %r12
incl %r11d
movl 0x598982(%rip), %eax    # 0x5db210
leal 0x7fffffff(%rax), %esi
xorl %edi, %edi
testl %r11d, %esi
sete %dil
shll $0x5, %edi
addq %rdi, %rcx
jmp 0x427f0
cmpl $0x2, %esi
jne 0x429da
cmpl $0x7, %edi
jle 0x429da
addl -0x54(%rsp), %ebp
cmpl $0x8, %ebp
movl $0x8, %esi
cmovgel %esi, %ebp
xorl %r11d, %r11d
testl %ebp, %ebp
cmovlel %r11d, %ebp
movl %ebp, -0x58(%rsp)
movq -0x50(%rsp), %r12
cmpl -0x58(%rsp), %r11d
je 0x42b09
movq %r8, -0x40(%rsp)
xorl %eax, %eax
cmpq $0x7, %rax
ja 0x429a4
movl (%r12,%rax,4), %r9d
movl (%rcx,%rax,2), %edx
movl 0x100(%rcx,%rax,2), %esi
sarl $0xd, %esi
andl $-0x2, %esi
sarl $0xd, %edx
andl $-0x2, %edx
movslq %esi, %rbp
movslq %edx, %rdx
movl 0x2000(%rbx,%rdx,4), %esi
movl 0x2004(%rbx,%rdx,4), %r13d
addl 0x2004(%r10,%rbp,4), %esi
movl 0x2000(%r10,%rbp,4), %edx
leal (%rdx,%r9), %ebp
shrl $0x16, %ebp
leal (%rsi,%r9), %edi
shrl $0x16, %edi
leaq 0x59a645(%rip), %r14    # 0x5dcf90
movl (%r14,%rdi,4), %edi
movq %rcx, %r8
leaq 0x59b637(%rip), %rcx    # 0x5ddf90
addl (%rcx,%rbp,4), %edi
addl %r13d, %r9d
shrl $0x16, %r9d
addl (%r15,%r9,4), %edi
movq -0x40(%rsp), %rbp
movl %edi, (%rbp,%rax,4)
movl 0x4(%r12,%rax,4), %edi
leal (%rdi,%rdx), %r9d
shrl $0x16, %r9d
addl %edi, %esi
shrl $0x16, %esi
movl (%r14,%rsi,4), %esi
addl (%rcx,%r9,4), %esi
movq %r8, %rcx
addl %r13d, %edi
shrl $0x16, %edi
addl (%r15,%rdi,4), %esi
movl %esi, 0x4(%rbp,%rax,4)
addq $0x2, %rax
jmp 0x428ed
movslq 0x587465(%rip), %rax    # 0x5c9e10
movq -0x40(%rsp), %r8
addq %rax, %r8
addq $0x20, %r12
incl %r11d
movl 0x598850(%rip), %eax    # 0x5db210
leal 0x7fffffff(%rax), %esi
xorl %edi, %edi
testl %r11d, %esi
sete %dil
shll $0x5, %edi
addq %rdi, %rcx
jmp 0x428db
movslq %r9d, %rsi
movq %rsi, -0x40(%rsp)
addl -0x54(%rsp), %ebp
cmpl $0x8, %ebp
movl $0x8, %esi
cmovgel %esi, %ebp
xorl %r9d, %r9d
testl %ebp, %ebp
cmovlel %r9d, %ebp
movl %ebp, -0x58(%rsp)
movq -0x50(%rsp), %rsi
movq %rsi, -0x18(%rsp)
cmpl -0x58(%rsp), %r9d
je 0x42b02
movl %r9d, -0x2c(%rsp)
leaq 0x59a571(%rip), %r10    # 0x5dcf90
xorl %eax, %eax
movl $0x1, %r9d
xorl %esi, %esi
cmpq -0x40(%rsp), %rax
jge 0x42aca
movq %r15, %r12
decl %r9d
jne 0x42a61
movl 0x5987bd(%rip), %r9d    # 0x5db200
movslq %esi, %rsi
movl (%rcx,%rsi,4), %r13d
movl 0x100(%rcx,%rsi,4), %edx
sarl $0xd, %edx
andl $-0x2, %edx
sarl $0xd, %r13d
andl $-0x2, %r13d
incl %esi
leaq 0x59c528(%rip), %r15    # 0x5def90
movq -0x18(%rsp), %rdi
movl (%rdi,%rax,4), %edi
movslq %edx, %r11
movl 0x2000(%r15,%r11,4), %r14d
addl %edi, %r14d
shrl $0x16, %r14d
movl 0x2004(%r15,%r11,4), %r11d
addl %edi, %r11d
movslq %r13d, %r15
addl 0x2000(%rbx,%r15,4), %r11d
shrl $0x16, %r11d
movl (%r10,%r11,4), %r11d
leaq 0x59b4e9(%rip), %rbp    # 0x5ddf90
addl (%rbp,%r14,4), %r11d
addl 0x2004(%rbx,%r15,4), %edi
shrl $0x16, %edi
movq %r12, %r15
addl (%r12,%rdi,4), %r11d
movl %r11d, (%r8,%rax,4)
incq %rax
jmp 0x42a29
movslq 0x58733f(%rip), %rax    # 0x5c9e10
addq %rax, %r8
addq $0x20, -0x18(%rsp)
movl -0x2c(%rsp), %r9d
incl %r9d
movl 0x598728(%rip), %eax    # 0x5db210
leal 0x7fffffff(%rax), %esi
xorl %edi, %edi
testl %r9d, %esi
sete %dil
shll $0x5, %edi
addq %rdi, %rcx
jmp 0x42a08
leaq 0x59c487(%rip), %r10    # 0x5def90
movq -0x38(%rsp), %r8
addq $0x8, %r8
addq $0x100, -0x50(%rsp)     # imm = 0x100
jmp 0x42714
movl 0x5986da(%rip), %esi    # 0x5db200
shll $0x6, %esi
movslq %esi, %rsi
movq -0x50(%rsp), %rdi
leaq (%rdi,%rsi,4), %rdi
movq %rdi, -0x50(%rsp)
movq -0x28(%rsp), %rdi
addl $0x8, %edi
addl $-0x8, -0x44(%rsp)
jmp 0x426b2
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq