// File: /workspace/github_c_makefile_star2_O2/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 0x3e97(%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 0x3e67(%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), %ecx
movl 0x4(%rdi), %esi
pushq $0x2
popq %r10
movl %ecx, %eax
cltd
idivl %r10d
cvtsi2sd %eax, %xmm0
movapd %xmm1, %xmm3
unpckhpd %xmm1, %xmm3            # xmm3 = xmm3[1],xmm1[1]
divsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %r8d
movl %r8d, 0x3f0(%rdi)
cvtsi2sd %esi, %xmm0
divsd %xmm3, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, %r11d
negl %r11d
cmovsl %eax, %r11d
movl %r11d, 0x3f4(%rdi)
movl %r11d, %r9d
shrl %r9d
movl %esi, %eax
cltd
idivl %r10d
leal (%r9,%rax), %edx
subl %r9d, %eax
xorl %r10d, %r10d
testl %eax, %eax
cmovlel %r10d, %eax
movl %eax, 0x3fc(%rdi)
cmpl %esi, %edx
cmovll %edx, %esi
movl %esi, 0x400(%rdi)
movl %r11d, 0x408(%rdi)
movl %r8d, %eax
subl %r9d, %eax
testl %eax, %eax
cmovlel %r10d, %eax
movl %eax, 0x3f8(%rdi)
addl %r8d, %r9d
cmpl %ecx, %r9d
cmovgel %ecx, %r9d
movl %r9d, 0x404(%rdi)
retq