// File: /workspace/github_c_makefile_star2_O1/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
subq $0x28, %rsp
movl %ecx, %ebx
movl %edx, %r14d
movq %rdi, %r12
movl %edx, %ecx
shll $0xa, %ecx
movq %rsi, -0x38(%rbp)
leal -0x1(%rsi), %eax
movq %rax, -0x48(%rbp)
decl %r8d
movl %r8d, -0x3c(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x38(%rbp), %rax
movq %rcx, -0x50(%rbp)
addl %ecx, %eax
movzbl 0x1700014(%r12,%rax), %ecx
testl %ecx, %ecx
je 0x383d
cmpl $0xff, %ecx
jne 0x3858
jmp 0x3a01
movslq 0xa00004(%r12), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0xa00004(%r12)
movl %eax, 0x600004(%r12,%rdx,4)
addl %ebx, %ecx
movl $0xff, %edx
cmpl %edx, %ecx
cmovgel %edx, %ecx
movb %cl, 0x1700014(%r12,%rax)
movl -0x3c(%rbp), %r13d
addl -0x30(%rbp), %r13d
je 0x3a01
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
divsd 0x17b7(%rip), %xmm0     # 0x5040
cvtsd2ss %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtsi2ss %ebx, %xmm1
mulss %xmm0, %xmm0
mulss 0x1984(%rip), %xmm0     # 0x5224
mulss 0x1980(%rip), %xmm1     # 0x5228
mulss 0x197c(%rip), %xmm0     # 0x522c
addss %xmm1, %xmm0
cvttss2si %xmm0, %ebx
testl %ebx, %ebx
jle 0x3a01
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
leal (%rax,%rcx), %r15d
cmpl $0x3fe, %r15d           # imm = 0x3FE
jg 0x38f2
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
leal (%rax,%rcx), %esi
incl %esi
movq %r12, %rdi
movl %r14d, %edx
movl %ebx, %ecx
movl %r13d, %r8d
callq 0x37e1
cmpl $0x3fe, %r14d           # imm = 0x3FE
jg 0x390f
leal 0x1(%r14), %edx
movq %r12, %rdi
movl %r15d, %esi
movl %ebx, %ecx
movl %r13d, %r8d
callq 0x37e1
testl %r15d, %r15d
jle 0x392f
movq -0x48(%rbp), %rax
movq -0x30(%rbp), %rcx
leal (%rax,%rcx), %esi
movq %r12, %rdi
movl %r14d, %edx
movl %ebx, %ecx
movl %r13d, %r8d
callq 0x37e1
testl %r14d, %r14d
jle 0x3948
leal -0x1(%r14), %edx
movq %r12, %rdi
movl %r15d, %esi
movl %ebx, %ecx
movl %r13d, %r8d
callq 0x37e1
xorps %xmm0, %xmm0
cvtsi2ss %ebx, %xmm0
mulss 0x18d5(%rip), %xmm0     # 0x522c
cvttss2si %xmm0, %ebx
testl %ebx, %ebx
jle 0x3a01
testl %r14d, %r14d
jle 0x39b0
cmpl $0x3fe, %r15d           # imm = 0x3FE
jg 0x398f
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
leal (%rax,%rcx), %esi
incl %esi
leal -0x1(%r14), %edx
movq %r12, %rdi
movl %ebx, %ecx
movl %r13d, %r8d
callq 0x37e1
testl %r15d, %r15d
jle 0x39b0
movq -0x48(%rbp), %rax
movq -0x30(%rbp), %rcx
leal (%rax,%rcx), %esi
leal -0x1(%r14), %edx
movq %r12, %rdi
movl %ebx, %ecx
movl %r13d, %r8d
callq 0x37e1
cmpl $0x3fe, %r14d           # imm = 0x3FE
jg 0x3a01
cmpl $0x3fe, %r15d           # imm = 0x3FE
jg 0x39e0
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
leal (%rax,%rcx), %esi
incl %esi
leal 0x1(%r14), %edx
movq %r12, %rdi
movl %ebx, %ecx
movl %r13d, %r8d
callq 0x37e1
testl %r15d, %r15d
jle 0x3a01
incl %r14d
movq -0x30(%rbp), %rax
decl %eax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rcx
addl $0x3ff, %ecx            # imm = 0x3FF
jmp 0x3819
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq