// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelUtils.cpp
// Function: gaps::CreateConnectedPointSet(gaps::R3SurfelPointSet*, double, double, double)
R3SurfelPointSet *
CreateConnectedPointSet(R3SurfelPointSet *pointset, 
  RNScalar min_volume, RNScalar max_volume, RNLength max_spacing)
{
  // Create grid
  R3Grid *grid = CreateGrid(pointset, max_spacing);
  if (!grid) return NULL;

  // Find largest connected component
  if (!MaskToLargestConnectedComponent(grid, 0.5, min_volume, max_volume)) { 
    delete grid; 
    return NULL; 
  }

  // Create connnected point set
  R3SurfelGridConstraint constraint(grid);
  R3SurfelPointSet *connected_pointset = CreatePointSet(pointset, &constraint);

  // Delete grid
  delete grid;

  // Return connected point set
  return connected_pointset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movsd %xmm1, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rdi, %r14
movapd %xmm2, %xmm0
movl $0x400, %esi            # imm = 0x400
callq 0x25edc
testq %rax, %rax
je 0x25eb2
movq %rax, %rbx
movslq 0x24c(%rax), %rbp
testq %rbp, %rbp
je 0x25e9d
movsd 0x220(%rbx), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %rbp, %rax
shlq $0x2, %rax
testl %ebp, %ebp
movq $-0x1, %r15
cmovnsq %rax, %r15
movq %r15, %rdi
callq 0x13030
movq %rax, %r13
movq %r15, %rdi
callq 0x13030
movq %rax, %r12
movq %r15, %rdi
callq 0x13030
movq %rax, %r15
movsd 0xb83f0(%rip), %xmm0    # 0xde140
movq %rbx, %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
callq 0x822b0
testl %eax, %eax
jle 0x25e85
movsd 0x8(%rsp), %xmm1
movapd %xmm1, %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
mulsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %edx
movl %eax, %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %edi, %edi
xorl %r8d, %r8d
testl %ecx, %ecx
jle 0x25dac
cmpl %ecx, (%r13,%rdi,4)
jl 0x25dc6
testl %edx, %edx
jle 0x25db7
cmpl %edx, (%r13,%rdi,4)
jg 0x25dc6
movl (%r13,%rdi,4), %r9d
cmpl %r8d, %r9d
cmovgl %edi, %eax
cmovgl %r9d, %r8d
incq %rdi
cmpq %rdi, %rsi
jne 0x25da1
testl %eax, %eax
js 0x25e85
movslq 0x24c(%rbx), %rcx
testq %rcx, %rcx
jle 0x25e0e
movq 0x230(%rbx), %rdx
xorl %esi, %esi
movsd 0xb835d(%rip), %xmm0    # 0xde150
movapd %xmm0, %xmm1
cmpl %eax, (%r15,%rsi,4)
je 0x25e01
xorpd %xmm1, %xmm1
movsd %xmm1, (%rdx,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x25df3
movq %r13, %rdi
callq 0x13680
movq %r12, %rdi
callq 0x13680
movq %r15, %rdi
callq 0x13680
leaq 0x10eddb(%rip), %rax    # 0x134c08
movsd (%rax), %xmm0
leaq 0x20(%rsp), %r15
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
movq %r15, %rdi
movq %rbx, %rsi
movl $0x4, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x30b3e
movq %r14, %rdi
movq %r15, %rsi
callq 0x22118
movq %rax, %r14
movq %rbx, %rdi
callq 0x7747c
movl $0x250, %esi            # imm = 0x250
movq %rbx, %rdi
callq 0x134f0
leaq 0x20(%rsp), %rdi
callq 0x321ae
jmp 0x25eb5
movq %r13, %rdi
callq 0x13680
movq %r12, %rdi
callq 0x13680
movq %r15, %rdi
callq 0x13680
movq %rbx, %rdi
callq 0x7747c
movl $0x250, %esi            # imm = 0x250
movq %rbx, %rdi
callq 0x134f0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x321ae
movq %rbx, %rdi
callq 0x138b0