// File: /workspace/github_cpp_makefile_star2_O3/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 0x25bef
testq %rax, %rax
je 0x25bc5
movq %rax, %rbx
movslq 0x24c(%rax), %rbp
testq %rbp, %rbp
je 0x25bb0
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 0xb76e9(%rip), %xmm0    # 0xdd138
movq %rbx, %rdi
movl %ebp, %esi
movq %r12, (%rsp)
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
callq 0x813f0
testl %eax, %eax
jle 0x25b97
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 %edx, %edx
setg %r10b
testl %ecx, %ecx
setg %bpl
movl (%r13,%rdi,4), %r9d
cmpl %ecx, %r9d
setl %r12b
cmpl %edx, %r9d
setg %r11b
testb %r12b, %bpl
jne 0x25ad7
andb %r11b, %r10b
jne 0x25ad7
cmpl %r8d, %r9d
cmovgl %edi, %eax
cmovgl %r9d, %r8d
incq %rdi
cmpq %rdi, %rsi
jne 0x25aa4
testl %eax, %eax
js 0x25b97
movslq 0x24c(%rbx), %rcx
testq %rcx, %rcx
jle 0x25b1f
movq 0x230(%rbx), %rdx
xorl %esi, %esi
movsd 0xb7644(%rip), %xmm0    # 0xdd148
movapd %xmm0, %xmm1
cmpl %eax, (%r15,%rsi,4)
je 0x25b12
xorpd %xmm1, %xmm1
movsd %xmm1, (%rdx,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x25b04
movq %r13, %rdi
callq 0x13680
movq (%rsp), %rdi
callq 0x13680
movq %r15, %rdi
callq 0x13680
leaq 0x10e0c9(%rip), %rax    # 0x133c08
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 0x3074a
movq %r14, %rdi
movq %r15, %rsi
callq 0x21f14
movq %rax, %r14
movq %rbx, %rdi
callq 0x766d6
movl $0x250, %esi            # imm = 0x250
movq %rbx, %rdi
callq 0x134f0
leaq 0x20(%rsp), %rdi
callq 0x31dba
jmp 0x25bc8
movq %r13, %rdi
callq 0x13680
movq (%rsp), %rdi
callq 0x13680
movq %r15, %rdi
callq 0x13680
movq %rbx, %rdi
callq 0x766d6
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 0x31dba
movq %rbx, %rdi
callq 0x138b0