// File: /workspace/github_c_makefile_star2_O0/aap[P]rx-0/misc/crt.c
// Function: render
static void
render(CRT *crt)
{
	int i, p, v, u;
	float f;
	Color c;

	renderpixels(crt);

	/* clear faded phos1 pixels */
	for(i = 0; i < crt->numClearPixels; i++)
		crt->pixels[crt->clearList[i]] = bg;
	crt->numClearPixels = 0;

	/* process phosphor 2 */
	for(i = 0; i < crt->numPhos2; i++){
		p = crt->phos2List[i];
		c = phos2ramp[crt->phos2vals[p]];
		crt->pixels[p] = RGBA(c.r, c.g, c.b, c.a);
	}

	/* process phosphor 1 */
	for(i = 0; i < crt->numPhos1; i++){
		p = crt->phos1List[i];
		v = crt->phos1vals[p];
		if(v >= pixelSustainMin){
			/* Phos1 bright enough, leave a Phos2 trace */
			if(crt->phos2vals[p] == 0)
				crt->phos2List[crt->numPhos2++] = p;
			f = v >= intensityOffset ?
				1.0 :
				1.0 - (float)(intensityOffset-v)/sustainTransferCf;
			u = f*255;
			if(crt->phos2vals[p] < u)
				crt->phos2vals[p] = u;
		}else if(crt->phos2vals[p] == 0)
			/* Not bright enough,
			 * clear pixel if phos2 wasn't drawn */
			crt->clearList[crt->numClearPixels++] = p;
		/* Apply pixel with phos1 and phos2 values */
		drawtoscreen(crt, p, crt->phos2vals[p], v);
		crt->phos1vals[p] = 0;
	}
	crt->numPhos1 = 0;

	/* fade phosphor 2 */
	crt->numTmp = 0;
	for(i = 0; i < crt->numPhos2; i++){
		p = crt->phos2List[i];
		v = crt->phos2vals[p];
		v *= sustainFactor*(1.0-(frand()-0.5)*sustainFuzzyness);
		if(v >= phos2MinVal){
			crt->phos2vals[p] = v;
			crt->tmpList[crt->numTmp++] = p;
		}else{
			crt->phos2vals[p] = 0;
			crt->pixels[p] = bg;
		}
	}
	memcpy(crt->phos2List, crt->tmpList, crt->numTmp*sizeof(int));
	crt->numPhos2 = crt->numTmp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4020
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x120000c(%rcx), %eax
jge 0x3c67
movl 0x1d04f8f(%rip), %edx   # 0x1d08bd0
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rsi
movslq 0xe0000c(%rcx,%rsi,4), %rcx
movl %edx, 0x1900014(%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3c2c
movq -0x8(%rbp), %rax
movl $0x0, 0x120000c(%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xe00008(%rcx), %eax
jge 0x3cf5
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl 0xa00008(%rax,%rcx,4), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzbl 0x1800014(%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x1d04b1a(%rip), %rax   # 0x1d087d0
movl (%rax,%rcx,4), %eax
movl %eax, -0x20(%rbp)
movzbl -0x20(%rbp), %edx
shll $0x18, %edx
movzbl -0x1f(%rbp), %eax
shll $0x10, %eax
orl %eax, %edx
movzbl -0x1e(%rbp), %eax
shll $0x8, %eax
orl %eax, %edx
movzbl -0x1d(%rbp), %eax
orl %eax, %edx
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl %edx, 0x1900014(%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3c7c
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xa00004(%rcx), %eax
jge 0x3e8d
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl 0x600004(%rax,%rcx,4), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzbl 0x1700014(%rax,%rcx), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x456b(%rip), %eax      # 0x82a8
jl 0x3e13
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzbl 0x1800014(%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x3d7e
movl -0x10(%rbp), %edx
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rsi
movl 0xe00008(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0xe00008(%rsi)
movslq %ecx, %rcx
movl %edx, 0xa00008(%rax,%rcx,4)
movl -0x14(%rbp), %eax
cmpl 0x1d0461d(%rip), %eax   # 0x1d083a4
jl 0x3d98
movsd 0x227f(%rip), %xmm0     # 0x6010
movsd %xmm0, -0x28(%rbp)
jmp 0x3dc6
movl 0x1d04606(%rip), %eax   # 0x1d083a4
subl -0x14(%rbp), %eax
cvtsi2ss %eax, %xmm0
cvtsi2ssl 0x1d045fb(%rip), %xmm1 # 0x1d083a8
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x2253(%rip), %xmm0     # 0x6010
subsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x1c(%rbp)
movss 0x23f0(%rip), %xmm0     # 0x61cc
mulss -0x1c(%rbp), %xmm0
cvttss2si %xmm0, %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzbl 0x1800014(%rax,%rcx), %eax
cmpl -0x18(%rbp), %eax
jge 0x3e11
movl -0x18(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movb %dl, 0x1800014(%rax,%rcx)
jmp 0x3e50
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzbl 0x1800014(%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x3e4e
movl -0x10(%rbp), %edx
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rsi
movl 0x120000c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x120000c(%rsi)
movslq %ecx, %rcx
movl %edx, 0xe0000c(%rax,%rcx,4)
jmp 0x3e50
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzbl 0x1800014(%rax,%rcx), %edx
movl -0x14(%rbp), %ecx
callq 0x40f0
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movb $0x0, 0x1700014(%rax,%rcx)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3cfc
movq -0x8(%rbp), %rax
movl $0x0, 0xa00004(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x1600010(%rax)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xe00008(%rcx), %eax
jge 0x3fd6
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl 0xa00008(%rax,%rcx,4), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movzbl 0x1800014(%rax,%rcx), %eax
movl %eax, -0x14(%rbp)
movss 0x1d044c0(%rip), %xmm0  # 0x1d083b0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
callq 0x2680
movsd -0x30(%rbp), %xmm1
cvtss2sd %xmm0, %xmm0
movsd 0x2129(%rip), %xmm2     # 0x6038
subsd %xmm2, %xmm0
movss 0x4391(%rip), %xmm2     # 0x82ac
cvtss2sd %xmm2, %xmm2
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd %xmm2, %xmm0
movsd 0x20ce(%rip), %xmm2     # 0x6010
addsd %xmm2, %xmm0
mulsd %xmm0, %xmm1
cvtsi2sdl -0x14(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl 0x1d0485d(%rip), %eax   # 0x1d087c0
jl 0x3fa1
movl -0x14(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movb %dl, 0x1800014(%rax,%rcx)
movl -0x10(%rbp), %edx
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rsi
movl 0x1600010(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x1600010(%rsi)
movslq %ecx, %rcx
movl %edx, 0x1200010(%rax,%rcx,4)
jmp 0x3fc6
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movb $0x0, 0x1800014(%rax,%rcx)
movl 0x1d04c19(%rip), %edx   # 0x1d08bd0
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movl %edx, 0x1900014(%rax,%rcx,4)
jmp 0x3fc8
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3eb0
movq -0x8(%rbp), %rdi
addq $0xa00008, %rdi         # imm = 0xA00008
movq -0x8(%rbp), %rsi
addq $0x1200010, %rsi        # imm = 0x1200010
movq -0x8(%rbp), %rax
movslq 0x1600010(%rax), %rdx
shlq $0x2, %rdx
callq 0x21e0
movq -0x8(%rbp), %rax
movl 0x1600010(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xe00008(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)