// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelConstraint.cpp
// Function: gaps::R3SurfelViewConstraint::R3SurfelViewConstraint(gaps::R3SurfelImage const&, double, double, gaps::R2Grid const*, int)
R3SurfelViewConstraint::
R3SurfelViewConstraint(
  const R3SurfelImage& image,
  RNLength neardist, RNLength fardist, 
  const R2Grid *image_mask,
  RNBoolean must_be_inside_frustum)
  : frustum(image.Frustum()),
    world_to_camera(image.Extrinsics()),
    w(image.ImageWidth()), h(image.ImageHeight()),
    fx(image.XFocal()), fy(image.YFocal()),
    cx(image.ImageCenter().X()), cy(image.ImageCenter().Y()),
    neardist(neardist), fardist(fardist),
    image_mask(image_mask),
    must_be_inside_frustum(must_be_inside_frustum)
{
  // Compute default image center
  if (this->cx <= 0) this->cx = 0.5*w;
  if (this->cy <= 0) this->cy = 0.5*h;

  // Compute default near and far distances
  if (this->neardist <= 0) this->neardist = RN_EPSILON;
  if (this->fardist <= 0) this->fardist = RN_INFINITY;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xfd33a(%rip), %rax     # 0x12e3a8
movq %rax, (%rdi)
leaq 0x102b90(%rip), %rax    # 0x133c08
movsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0x102b8f(%rip), %rax    # 0x133c18
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
addq $0x78, %rsi
leaq 0x30(%rsp), %rdi
callq 0x85490
movsd 0xb0(%r15), %xmm2
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
xorpd %xmm0, %xmm0
jae 0x310d9
xorps %xmm0, %xmm0
cvtsi2sdl 0x98(%r15), %xmm0
mulsd 0xac06c(%rip), %xmm0    # 0xdd138
divsd %xmm2, %xmm0
callq 0x13410
xorpd %xmm1, %xmm1
leaq 0x8(%rbx), %r12
movsd 0xb8(%r15), %xmm2
ucomisd %xmm2, %xmm1
jae 0x31119
movsd %xmm0, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x9c(%r15), %xmm0
mulsd 0xac032(%rip), %xmm0    # 0xdd138
divsd %xmm2, %xmm0
callq 0x13410
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
leaq 0x60(%r15), %rcx
leaq 0x30(%r15), %r13
leaq 0x30(%rsp), %rdx
movq %r12, %rdi
movq %r13, %rsi
movsd 0x28(%rsp), %xmm2
movsd 0x20(%rsp), %xmm3
callq 0x6abf0
leaq 0x150(%rbx), %rdi
movq %r13, %rsi
callq 0x70856
movl 0x98(%r15), %ecx
movl %ecx, 0x1d0(%rbx)
movl 0x9c(%r15), %eax
movl %eax, 0x1d4(%rbx)
movups 0xb0(%r15), %xmm0
movups %xmm0, 0x1d8(%rbx)
movsd 0xa0(%r15), %xmm2
movsd %xmm2, 0x1e8(%rbx)
movsd 0xa8(%r15), %xmm0
movsd %xmm0, 0x1f0(%rbx)
movsd 0x10(%rsp), %xmm4
movsd %xmm4, 0x1f8(%rbx)
movsd 0x18(%rsp), %xmm3
movsd %xmm3, 0x200(%rbx)
movq %r14, 0x208(%rbx)
movl %ebp, 0x210(%rbx)
xorpd %xmm1, %xmm1
ucomisd %xmm2, %xmm1
jb 0x311e1
xorps %xmm2, %xmm2
cvtsi2sd %ecx, %xmm2
mulsd 0xabf5f(%rip), %xmm2    # 0xdd138
movsd %xmm2, 0x1e8(%rbx)
ucomisd %xmm0, %xmm1
jb 0x311fe
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0xabf42(%rip), %xmm0    # 0xdd138
movsd %xmm0, 0x1f0(%rbx)
xorpd %xmm0, %xmm0
ucomisd %xmm4, %xmm0
jb 0x3121b
leaq 0x1029f9(%rip), %rax    # 0x133c08
movsd (%rax), %xmm1
movsd %xmm1, 0x1f8(%rbx)
ucomisd %xmm3, %xmm0
jb 0x31234
leaq 0x1029f0(%rip), %rax    # 0x133c18
movsd (%rax), %xmm0
movsd %xmm0, 0x200(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r12, %rdi
callq 0x6e174
movq %rbx, %rdi
callq 0x138b0