// File: /workspace/github_cpp_makefile_star2_O2/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
leaq 0x38(%rdi), %r14
leaq -0x80(%rbp), %r12
movq %r12, %rdi
movq %r14, %rdx
callq 0x68ba
leaq 0x88(%rbx), %r13
movq 0x10(%r12), %rax
movq %rax, 0x98(%rbx)
movups (%r12), %xmm0
movups %xmm0, 0x88(%rbx)
leaq -0x80(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x4722
movq 0x10(%r15), %rax
movq %rax, 0x98(%rbx)
movups (%r15), %xmm0
movups %xmm0, 0x88(%rbx)
movq %r15, %rdi
movq %r14, %rsi
movq %r13, -0x60(%rbp)
movq %r13, %rdx
callq 0x68ba
leaq 0x70(%rbx), %rsi
movq 0x10(%r15), %rax
movq %rax, 0x80(%rbx)
movups (%r15), %xmm0
movq %r12, %r15
movups %xmm0, 0x70(%rbx)
leaq -0x80(%rbp), %r14
movq %r14, %rdi
movq %rsi, -0x58(%rbp)
callq 0x4722
movq 0x10(%r14), %rax
movq %rax, 0x80(%rbx)
movups (%r14), %xmm0
movups %xmm0, 0x70(%rbx)
movsd 0x60(%rbx), %xmm3
movapd %xmm3, %xmm2
divsd 0x50(%rbx), %xmm2
movsd 0x68(%rbx), %xmm1
cvttsd2si %xmm2, %eax
movapd %xmm1, %xmm2
divsd 0x58(%rbx), %xmm2
cvttsd2si %xmm2, %ecx
imull %eax, %ecx
movsd 0x2aae(%rip), %xmm0     # 0x9050
mulsd %xmm1, %xmm0
leaq 0x20(%rbx), %rax
movq %rax, -0x50(%rbp)
leaq 0x8(%rbx), %rax
movq %rax, -0x48(%rbp)
cvtsi2sd %ecx, %xmm2
movsd %xmm2, -0x40(%rbp)
leaq 0xa0(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq -0x98(%rbp), %r12
leaq -0xc8(%rbp), %r14
mulsd 0x2a38(%rip), %xmm1     # 0x9018
ucomisd %xmm0, %xmm1
jb 0x66cc
movapd %xmm3, %xmm2
mulsd 0x2a5a(%rip), %xmm2     # 0x9050
movsd %xmm0, -0x68(%rbp)
movapd %xmm3, %xmm1
mulsd 0x2a11(%rip), %xmm1     # 0x9018
ucomisd %xmm2, %xmm1
jb 0x66bd
movq %r12, %rdi
movq -0x60(%rbp), %rsi
movsd %xmm2, -0x30(%rbp)
callq 0x5ea9
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
movq -0x58(%rbp), %rsi
movsd -0x30(%rbp), %xmm0
callq 0x5ea9
movq %r14, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x5e50
movq %r15, %rdi
movq %r14, %rsi
movq -0x50(%rbp), %rdx
callq 0x5e50
pushq $0x38
popq %rdi
callq 0x31e0
movq %rax, %r13
movq %r14, %rdi
movq -0x48(%rbp), %rsi
movsd -0x40(%rbp), %xmm0
callq 0x693c
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x460e
movq %r12, %rdi
movq %r13, %rsi
callq 0x4640
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x69a2
leaq -0x90(%rbp), %rdi
callq 0x5092
movsd -0x30(%rbp), %xmm2
addsd 0x50(%rbx), %xmm2
movsd 0x60(%rbx), %xmm3
movsd -0x68(%rbp), %xmm0
jmp 0x65fb
addsd 0x58(%rbx), %xmm0
movsd 0x68(%rbx), %xmm1
jmp 0x65d8
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x5092
jmp 0x66fd
movq %rax, %rbx
pushq $0x38
popq %rsi
movq %r13, %rdi
callq 0x31f0
movq %rbx, %rdi
callq 0x32d0
nop