// File: /workspace/github_cpp_makefile_star2_O3/hamikm[P]Raytracer/src/arealight.hh
// Function: arealight<double, double, double, 3>::constructorHelper(mvector<double, 3> const&)
void constructorHelper(const mvector<vec_T, dim> &upDirection) {
		// Compute uhat by taking the cross product of the surface normal
		// and the up vector then normalizing.
		uhat = upDirection % norm;
		uhat = uhat.norm();

		// Compute vhat by taking the cross product of the surface normal
		// and uhat then normalizing.
		vhat = norm % uhat;
		vhat = vhat.norm();

		// Compute number of lights.
		int numlights = static_cast<int> (width / horizontalSpacing) *
				static_cast<int> (height / verticalSpacing);

		// Loop over the rows of the lights.
		for(vec_T u = -height / 2; u <= height / 2; u += verticalSpacing) {

			for(vec_T v = -width / 2; v <= width / 2; v += horizontalSpacing) {

				// Compute world coordinates from the local uv coordinates.
				mvector<vec_T, dim> worldpos = uhat * u + vhat * v +
						this->getPos();

				// Construct a point light at the world coordinates with a color
				// scaled so that the combination of all the lights in the area
				// light look like the color passed to the constructor.
				boost::shared_ptr<light<vec_T, color_T, time_T, dim> >
					currLight_sp(
							new light<vec_T, color_T, time_T, dim>(
									this->getColor() / numlights, worldpos));
				lights.push_back(currLight_sp);
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movsd (%rsi), %xmm0
movsd 0x8(%rsi), %xmm1
movsd 0x48(%rdi), %xmm2
movsd 0x10(%rsi), %xmm3
movsd 0x38(%rdi), %xmm4
movsd 0x40(%rdi), %xmm5
movapd %xmm1, %xmm6
mulsd %xmm2, %xmm6
mulsd %xmm0, %xmm2
mulsd %xmm5, %xmm0
mulsd %xmm3, %xmm5
subsd %xmm5, %xmm6
mulsd %xmm4, %xmm3
subsd %xmm2, %xmm3
mulsd %xmm1, %xmm4
subsd %xmm4, %xmm0
leaq 0x88(%rdi), %rsi
movsd %xmm6, 0x88(%rdi)
movsd %xmm3, 0x90(%rdi)
movsd %xmm0, 0x98(%rdi)
leaq -0x98(%rbp), %r14
movq %r14, %rdi
movq %rsi, -0x68(%rbp)
callq 0x4c98
movq 0x10(%r14), %rax
movq %rax, 0x98(%rbx)
movups (%r14), %xmm0
movups %xmm0, 0x88(%rbx)
movsd 0x38(%rbx), %xmm0
movsd 0x40(%rbx), %xmm1
movsd 0x98(%rbx), %xmm2
movsd 0x48(%rbx), %xmm3
movsd 0x90(%rbx), %xmm4
movapd %xmm4, %xmm5
mulsd %xmm3, %xmm5
movsd 0x88(%rbx), %xmm6
mulsd %xmm6, %xmm3
mulsd %xmm1, %xmm6
mulsd %xmm2, %xmm1
subsd %xmm5, %xmm1
mulsd %xmm0, %xmm2
subsd %xmm2, %xmm3
mulsd %xmm0, %xmm4
subsd %xmm6, %xmm4
leaq 0x70(%rbx), %rsi
movsd %xmm1, 0x70(%rbx)
movsd %xmm3, 0x78(%rbx)
movsd %xmm4, 0x80(%rbx)
movq %r14, %rdi
movq %rsi, -0x60(%rbp)
callq 0x4c98
movq 0x10(%r14), %rax
movq %rax, 0x80(%rbx)
movups (%r14), %xmm0
movups %xmm0, 0x70(%rbx)
movsd 0x68(%rbx), %xmm0
movsd 0x23e9(%rip), %xmm2     # 0x9048
mulsd %xmm0, %xmm2
movsd 0x23b5(%rip), %xmm1     # 0x9020
mulsd %xmm0, %xmm1
movsd %xmm2, -0x30(%rbp)
ucomisd %xmm2, %xmm1
jb 0x6e2a
movsd 0x58(%rbx), %xmm2
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
cvttsd2si %xmm1, %eax
movsd 0x60(%rbx), %xmm1
movapd %xmm1, %xmm3
divsd 0x50(%rbx), %xmm3
cvttsd2si %xmm3, %ecx
imull %eax, %ecx
leaq 0x20(%rbx), %rax
movq %rax, -0x58(%rbp)
movl %ecx, -0x34(%rbp)
xorps %xmm3, %xmm3
cvtsi2sd %ecx, %xmm3
movsd %xmm3, -0x50(%rbp)
leaq 0xa0(%rbx), %rax
movq %rax, -0x48(%rbp)
movsd 0x2352(%rip), %xmm5     # 0x9020
leaq -0x80(%rbp), %r13
leaq -0x98(%rbp), %r12
movapd %xmm1, %xmm4
mulsd 0x2363(%rip), %xmm4     # 0x9048
movapd %xmm1, %xmm3
mulsd %xmm5, %xmm3
ucomisd %xmm4, %xmm3
jb 0x6e0a
movsd %xmm4, -0x40(%rbp)
leaq -0xc8(%rbp), %r14
movq %r14, %rdi
movq -0x68(%rbp), %rsi
movsd -0x30(%rbp), %xmm0
callq 0x65a3
leaq -0xb0(%rbp), %r15
movq %r15, %rdi
movq -0x60(%rbp), %rsi
movsd -0x40(%rbp), %xmm0
callq 0x65a3
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x652a
movq %r12, %rdi
movq %r13, %rsi
movq -0x58(%rbp), %rdx
callq 0x652a
movl $0x38, %edi
callq 0x31c0
cmpl $0x0, -0x34(%rbp)
je 0x6e3c
movq %rax, %r14
movsd 0x8(%rbx), %xmm0
movsd 0x10(%rbx), %xmm1
movsd 0x18(%rbx), %xmm2
movsd -0x50(%rbp), %xmm3
divsd %xmm3, %xmm0
divsd %xmm3, %xmm1
divsd %xmm3, %xmm2
movsd %xmm0, 0x8(%rax)
movsd %xmm1, 0x10(%rax)
movsd %xmm2, 0x18(%rax)
leaq 0x6dc2(%rip), %rax      # 0xdb58
movq %rax, (%r14)
xorl %r15d, %r15d
movq %r12, %rdi
movl %r15d, %esi
callq 0x5b6e
movsd %xmm0, 0x20(%r14,%r15,8)
incq %r15
cmpq $0x3, %r15
jne 0x6d9c
movq %r13, %rdi
movq %r14, %rsi
callq 0x4b72
movq -0x48(%rbp), %rdi
movq %r13, %rsi
callq 0x7104
leaq -0x78(%rbp), %rdi
callq 0x576e
movsd -0x40(%rbp), %xmm4
addsd 0x50(%rbx), %xmm4
movsd 0x60(%rbx), %xmm1
movapd %xmm1, %xmm0
movsd 0x222e(%rip), %xmm5     # 0x9020
mulsd %xmm5, %xmm0
ucomisd %xmm4, %xmm0
jae 0x6cf7
movsd 0x58(%rbx), %xmm2
movsd 0x68(%rbx), %xmm0
movsd -0x30(%rbp), %xmm4
addsd %xmm2, %xmm4
movapd %xmm0, %xmm3
mulsd %xmm5, %xmm3
movsd %xmm4, -0x30(%rbp)
ucomisd %xmm4, %xmm3
jae 0x6cd9
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2c71(%rip), %rdi      # 0x9ab4
leaq 0x2469(%rip), %rsi      # 0x92b3
leaq 0x2c6f(%rip), %rcx      # 0x9ac0
movl $0xec, %edx
callq 0x30f0
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x576e
movq %rbx, %rdi
callq 0x32a0
nop