// File: /workspace/github_c_makefile_star2_O3/iciamyplant[P]Cub3d-Linux/src/sprites.c
// Function: ft_calculs
void	ft_calculs(t_recup *recup, int i)
{
	recup->s.spritex = recup->sxy[recup->s.order[i]].x - recup->ray.posx;
	recup->s.spritey = recup->sxy[recup->s.order[i]].y - recup->ray.posy;
	recup->s.invdet = 1.0 / (recup->ray.planx * recup->ray.diry -
			recup->ray.dirx * recup->ray.plany);
	recup->s.transformx = recup->s.invdet * (recup->ray.diry *
			recup->s.spritex - recup->ray.dirx * recup->s.spritey);
	recup->s.transformy = recup->s.invdet * (-recup->ray.plany *
			recup->s.spritex + recup->ray.planx * recup->s.spritey);
	recup->s.spritescreenx = (int)((recup->rx / 2) * (1 + recup->s.transformx
				/ recup->s.transformy));
	recup->s.spriteheight = abs((int)(recup->ry / (recup->s.transformy)));
	recup->s.drawstarty = -recup->s.spriteheight / 2 + recup->ry / 2;
	if (recup->s.drawstarty < 0)
		recup->s.drawstarty = 0;
	recup->s.drawendy = recup->s.spriteheight / 2 + recup->ry / 2;
	if (recup->s.drawendy >= recup->ry)
		recup->s.drawendy = recup->ry;
	recup->s.spritewidth = abs((int)(recup->ry / (recup->s.transformy)));
	recup->s.drawstartx = -recup->s.spritewidth / 2 + recup->s.spritescreenx;
	if (recup->s.drawstartx < 0)
		recup->s.drawstartx = 0;
	recup->s.drawendx = recup->s.spritewidth / 2 + recup->s.spritescreenx;
	if (recup->s.drawendx >= recup->rx)
		recup->s.drawendx = recup->rx;
}

// Assembly:
movq 0x418(%rdi), %rax
movq 0x3b8(%rdi), %rcx
movslq %esi, %rdx
movslq (%rcx,%rdx,4), %rcx
shlq $0x4, %rcx
movupd (%rax,%rcx), %xmm0
movupd 0x2d8(%rdi), %xmm1
subpd %xmm1, %xmm0
movupd %xmm0, 0x3c8(%rdi)
movsd 0x2f8(%rdi), %xmm3
movsd 0x2f0(%rdi), %xmm4
movsd 0x2e8(%rdi), %xmm5
movsd 0x300(%rdi), %xmm6
movapd 0x3d6b(%rip), %xmm7     # 0xd150
movapd %xmm6, %xmm1
mulsd %xmm5, %xmm1
xorpd %xmm7, %xmm5
unpcklpd %xmm3, %xmm5            # xmm5 = xmm5[0],xmm3[0]
mulsd %xmm4, %xmm3
subsd %xmm1, %xmm3
movsd 0x3d3b(%rip), %xmm2     # 0xd140
movapd %xmm2, %xmm1
divsd %xmm3, %xmm1
movsd %xmm1, 0x3d8(%rdi)
xorpd %xmm7, %xmm6
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
mulpd %xmm5, %xmm3
unpcklpd %xmm6, %xmm4            # xmm4 = xmm4[0],xmm6[0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm4, %xmm0
addpd %xmm3, %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm0, %xmm1
movupd %xmm1, 0x3e0(%rdi)
movl (%rdi), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movl 0x4(%rdi), %edx
movapd %xmm1, %xmm3
unpckhpd %xmm1, %xmm3            # xmm3 = xmm3[1],xmm1[1]
divsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
movl %ecx, 0x3f0(%rdi)
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
divsd %xmm3, %xmm0
cvttsd2si %xmm0, %esi
movl %esi, %r8d
negl %r8d
cmovsl %esi, %r8d
movl %r8d, 0x3f4(%rdi)
movl %r8d, %esi
shrl %esi
movl %edx, %r9d
shrl $0x1f, %r9d
addl %edx, %r9d
sarl %r9d
leal (%rsi,%r9), %r10d
subl %esi, %r9d
xorl %r11d, %r11d
testl %r9d, %r9d
cmovlel %r11d, %r9d
movl %r9d, 0x3fc(%rdi)
cmpl %edx, %r10d
cmovll %r10d, %edx
movl %edx, 0x400(%rdi)
movl %r8d, 0x408(%rdi)
movl %ecx, %edx
subl %esi, %edx
testl %edx, %edx
cmovlel %r11d, %edx
movl %edx, 0x3f8(%rdi)
addl %ecx, %esi
cmpl %eax, %esi
cmovgel %eax, %esi
movl %esi, 0x404(%rdi)
retq