// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl -0x10(%rbp), %eax
shll $0xa, %eax
addl -0xc(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl 0x1700014(%rax,%rcx), %eax
movl %eax, -0x20(%rbp)
cmpl $0xff, -0x20(%rbp)
jl 0x4376
jmp 0x4593
cmpl $0x0, -0x20(%rbp)
jne 0x43a2
movl -0x1c(%rbp), %edx
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rsi
movl 0xa00004(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0xa00004(%rsi)
movslq %ecx, %rcx
movl %edx, 0x600004(%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
cmpl $0xff, -0x20(%rbp)
jle 0x43be
movl $0xff, %eax
movl %eax, -0x2c(%rbp)
jmp 0x43c4
movl -0x20(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb %dl, 0x1700014(%rax,%rcx)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
je 0x4593
cvtsi2sdl -0x14(%rbp), %xmm0
movsd 0x1c21(%rip), %xmm1     # 0x6018
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x28(%rbp)
movss -0x28(%rbp), %xmm0
mulss -0x28(%rbp), %xmm0
movss 0x1db6(%rip), %xmm1     # 0x61cc
mulss %xmm1, %xmm0
movss 0x3e8e(%rip), %xmm2     # 0x82b0
cvtsi2ssl -0x14(%rbp), %xmm1
mulss 0x3e85(%rip), %xmm1     # 0x82b4
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jle 0x4591
cmpl $0x3ff, -0xc(%rbp)      # imm = 0x3FF
jge 0x446a
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x1, %esi
movl -0x10(%rbp), %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0x4330
cmpl $0x3ff, -0x10(%rbp)     # imm = 0x3FF
jge 0x448c
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
addl $0x1, %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0x4330
cmpl $0x0, -0xc(%rbp)
jle 0x44ab
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
subl $0x1, %esi
movl -0x10(%rbp), %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0x4330
cmpl $0x0, -0x10(%rbp)
jle 0x44ca
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
subl $0x1, %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0x4330
movss 0x3de6(%rip), %xmm1     # 0x82b8
cvtsi2ssl -0x24(%rbp), %xmm0
mulss %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jle 0x458f
cmpl $0x0, -0x10(%rbp)
jle 0x453b
cmpl $0x3ff, -0xc(%rbp)      # imm = 0x3FF
jge 0x4517
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x1, %esi
movl -0x10(%rbp), %edx
subl $0x1, %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0x4330
cmpl $0x0, -0xc(%rbp)
jle 0x4539
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
subl $0x1, %esi
movl -0x10(%rbp), %edx
subl $0x1, %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0x4330
jmp 0x453b
cmpl $0x3ff, -0x10(%rbp)     # imm = 0x3FF
jge 0x458d
cmpl $0x3ff, -0xc(%rbp)      # imm = 0x3FF
jge 0x4569
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
addl $0x1, %esi
movl -0x10(%rbp), %edx
addl $0x1, %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0x4330
cmpl $0x0, -0xc(%rbp)
jle 0x458b
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
subl $0x1, %esi
movl -0x10(%rbp), %edx
addl $0x1, %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
callq 0x4330
jmp 0x458d
jmp 0x458f
jmp 0x4591
jmp 0x4593
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)