// File: dmarto[P]crrs-xlib/main.cpp
// Function: Shadow(std::vector<Sphere*, std::allocator<Sphere*>> const&, Vec3 const&, Vec3 const&, Vec3&, Sphere const&)
void Shadow(const std::vector<Sphere *> &objects, const Vec3 &pointOfIntersection, const Vec3 &normal, Vec3 &pixclr,
			const Sphere &light)
{
	Colors color;

	double shadowIntensity = 2.3;

	for (auto &sphereB : objects)
	{
		const Ray ray2(pointOfIntersection, light.GetNormal(sphereB->center) * -3);
		double t2;
		if (sphereB->Intersects(ray2, t2))
		{
			const Vec3 pointOfIntersection2 = ray2.origin + ray2.destination * t2;
			const Vec3 len2 = pointOfIntersection - pointOfIntersection2;
			const Vec3 normal2 = sphereB->GetNormal(pointOfIntersection2);
			const double dotP2 = dot(len2.Normalize(), normal2.Normalize());

			Vec3 shadow = color.black + 1 * shadowIntensity;
			Vec3 pixclrBounce = pixclr * dotP2 * shadow;
			ColorBoundary(pixclrBounce);

			pixclr = pixclr - pixclrBounce;
		}
	}
}

// Assembly:
subq $0x288, %rsp            # imm = 0x288
movq %rdi, 0x280(%rsp)
movq %rsi, 0x278(%rsp)
movq %rdx, 0x270(%rsp)
movq %rcx, 0x268(%rsp)
movq %r8, 0x260(%rsp)
leaq 0x1d0(%rsp), %rdi
callq 0x3bd0
movsd 0x37d4(%rip), %xmm0     # 0x6048
movsd %xmm0, 0x1c8(%rsp)
movq 0x280(%rsp), %rax
movq %rax, 0x1c0(%rsp)
movq 0x1c0(%rsp), %rdi
callq 0x3ca0
movq %rax, 0x1b8(%rsp)
movq 0x1c0(%rsp), %rdi
callq 0x3cd0
movq %rax, 0x1b0(%rsp)
leaq 0x1b8(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x3d00
testb $0x1, %al
jne 0x28d5
jmp 0x2b39
leaq 0x1b8(%rsp), %rdi
callq 0x3d40
movq %rax, 0x1a8(%rsp)
movq 0x278(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x260(%rsp), %rsi
movq 0x1a8(%rsp), %rax
movq (%rax), %rdx
leaq 0x148(%rsp), %rdi
callq 0x4080
leaq 0x160(%rsp), %rdi
leaq 0x148(%rsp), %rsi
movsd 0x3721(%rip), %xmm0     # 0x6050
callq 0x3d50
movq 0x28(%rsp), %rsi
leaq 0x178(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x3da0
movq 0x1a8(%rsp), %rax
movq (%rax), %rdi
leaq 0x178(%rsp), %rsi
leaq 0x140(%rsp), %rdx
callq 0x3df0
testb $0x1, %al
jne 0x2977
jmp 0x2b25
leaq 0x178(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x178(%rsp), %rsi
addq $0x18, %rsi
movsd 0x140(%rsp), %xmm0
leaq 0x110(%rsp), %rdi
callq 0x3d50
movq 0x20(%rsp), %rsi
leaq 0x128(%rsp), %rdi
leaq 0x110(%rsp), %rdx
callq 0x3fc0
movq 0x278(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
leaq 0x128(%rsp), %rdx
callq 0x4020
movq 0x1a8(%rsp), %rax
movq (%rax), %rsi
leaq 0xe0(%rsp), %rdi
leaq 0x128(%rsp), %rdx
callq 0x4080
leaq 0xc0(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x4130
leaq 0xa8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x4130
leaq 0xc0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x40e0
movsd %xmm0, 0xd8(%rsp)
leaq 0x1d0(%rsp), %rsi
addq $0x30, %rsi
movsd 0x35ff(%rip), %xmm0     # 0x6058
mulsd 0x1c8(%rsp), %xmm0
cvttsd2si %xmm0, %edx
leaq 0x90(%rsp), %rdi
callq 0x4250
movq 0x268(%rsp), %rsi
movsd 0xd8(%rsp), %xmm0
leaq 0x60(%rsp), %rdi
callq 0x3d50
movq 0x90(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x48(%rsp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x42b0
leaq 0x78(%rsp), %rdi
callq 0x23e0
movq 0x268(%rsp), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x4020
movq 0x268(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, (%rax)
movq 0x38(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq 0x40(%rsp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x2b27
leaq 0x1b8(%rsp), %rdi
callq 0x4230
jmp 0x28b7
addq $0x288, %rsp            # imm = 0x288
retq
nopw %cs:(%rax,%rax)