// File: /workspace/github_c_makefile_star2_O2/aap[P]rx-0/misc/crt.c
// Function: renderpixel
static void
renderpixel(CRT *crt, int x, int y, int a, int level)
{
	int p, v, b;
	float f;

	p = y*1024 + x;
	v = crt->phos1vals[p];
	if(v >= 255) return;
	if(v == 0){
//		printf("adding phos1 %d\n", p);
		crt->phos1List[crt->numPhos1++] = p;
	}
	v += a;
	crt->phos1vals[p] = v > 255 ? 255 : v;

	if(--level){
		f = a/255.0;
		b = f*f*255*blurFactorSquare + a*blurFactorLinear;
		if(b > 0){
			if(x < 1023) renderpixel(crt, x+1, y, b, level);
			if(y < 1023) renderpixel(crt, x, y+1, b, level);
			if(x > 0) renderpixel(crt, x-1, y, b, level);
			if(y > 0) renderpixel(crt, x, y-1, b, level);
			b *= blurFactorDiagonal;
			if(b > 0){
				if(y > 0){
					if(x < 1023)
						renderpixel(crt, x+1, y-1, b, level);
					if(x > 0)
						renderpixel(crt, x-1, y-1, b, level);
				}
				if(y < 1023){
					if(x < 1023)
						renderpixel(crt, x+1, y+1, b, level);
					if(x > 0)
						renderpixel(crt, x-1, y+1, b, level);
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r13d
movl %esi, %ebx
movq %rdi, %r12
movl %edx, %r15d
decl %r8d
movl %r8d, -0x2c(%rbp)
movl %r15d, %eax
shll $0xa, %eax
addl %ebx, %eax
movzbl 0x1700014(%r12,%rax), %ecx
testl %ecx, %ecx
je 0x3565
cmpl $0xff, %ecx
jne 0x3580
jmp 0x36f2
movslq 0xa00004(%r12), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0xa00004(%r12)
movl %eax, 0x600004(%r12,%rdx,4)
addl %r13d, %ecx
movl $0xff, %edx
cmpl %edx, %ecx
cmovgel %edx, %ecx
movb %cl, 0x1700014(%r12,%rax)
movl -0x2c(%rbp), %r14d
subl $0x1, %r14d
jb 0x36f2
cvtsi2sd %r13d, %xmm0
divsd 0x1a90(%rip), %xmm0     # 0x5040
cvtsd2ss %xmm0, %xmm0
cvtsi2ss %r13d, %xmm1
mulss %xmm0, %xmm0
mulss 0x1c5f(%rip), %xmm0     # 0x5224
mulss 0x1c5b(%rip), %xmm1     # 0x5228
mulss 0x1c57(%rip), %xmm0     # 0x522c
addss %xmm1, %xmm0
cvttss2si %xmm0, %r13d
testl %r13d, %r13d
jle 0x36f2
cmpl $0x3ff, %ebx            # imm = 0x3FF
jge 0x3604
leal 0x1(%rbx), %esi
movq %r12, %rdi
movl %r15d, %edx
movl %r13d, %ecx
movl -0x2c(%rbp), %r8d
callq 0x3523
cmpl $0x3fe, %r15d           # imm = 0x3FE
jg 0x3622
leal 0x1(%r15), %edx
movq %r12, %rdi
movl %ebx, %esi
movl %r13d, %ecx
movl -0x2c(%rbp), %r8d
callq 0x3523
testl %ebx, %ebx
jle 0x363b
leal -0x1(%rbx), %esi
movq %r12, %rdi
movl %r15d, %edx
movl %r13d, %ecx
movl -0x2c(%rbp), %r8d
callq 0x3523
testl %r15d, %r15d
jle 0x3655
leal -0x1(%r15), %edx
movq %r12, %rdi
movl %ebx, %esi
movl %r13d, %ecx
movl -0x2c(%rbp), %r8d
callq 0x3523
cvtsi2ss %r13d, %xmm0
mulss 0x1bca(%rip), %xmm0     # 0x522c
cvttss2si %xmm0, %r13d
testl %r13d, %r13d
jle 0x36f2
testl %r15d, %r15d
jle 0x36be
cmpl $0x3ff, %ebx            # imm = 0x3FF
jge 0x369f
leal 0x1(%rbx), %esi
leal -0x1(%r15), %edx
movl %edx, -0x30(%rbp)
movq %r12, %rdi
movl %r13d, %ecx
movl -0x2c(%rbp), %r8d
callq 0x3523
movl -0x30(%rbp), %edx
testl %ebx, %ebx
jg 0x36a3
jmp 0x36b5
leal -0x1(%r15), %edx
leal -0x1(%rbx), %esi
movq %r12, %rdi
movl %r13d, %ecx
movl -0x2c(%rbp), %r8d
callq 0x3523
cmpl $0x3fe, %r15d           # imm = 0x3FE
jg 0x36f2
cmpl $0x3ff, %ebx            # imm = 0x3FF
jge 0x36e4
leal 0x1(%rbx), %esi
incq %r15
movq %r12, %rdi
movl %r15d, %edx
movl %r13d, %ecx
movl -0x2c(%rbp), %r8d
callq 0x3523
testl %ebx, %ebx
jg 0x36e7
jmp 0x36f2
incq %r15
decl %ebx
movl %r14d, -0x2c(%rbp)
jmp 0x3543
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)