// File: /workspace/github_cpp_makefile_star2_O3/Luthaf[P]zeopp/geometry.cc
// Function: findLineSegIntersections(Point, Point, Point, double)
pair<int, vector<Point> > findLineSegIntersections(Point p1, Point p2, Point circCenter, double rad){
  pair<int, vector<Point> > prelimResults = findLineIntersections(p1, p2, circCenter, rad);
 
  if(prelimResults.first == 0)
    return prelimResults;
  else{
    double tolerance = 0.00001;
    int numResults = 0;
    vector<Point> pts = vector<Point> ();
    double lineSegLength = calcEuclideanDistance(p1, p2);
    for(int i = 0; i < prelimResults.first; i++){
      Point possSol = prelimResults.second.at(i);
      double p1Dist = calcEuclideanDistance(possSol, p1);
      double p2Dist = calcEuclideanDistance(possSol, p2);
      if((p1Dist <= lineSegLength + tolerance) && (p2Dist <= lineSegLength + tolerance)){
	pts.push_back(possSol);
	numResults++;
      }
    }
    return pair<int, vector<Point> > (numResults, pts);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, %rbx
movq 0x170(%rsp), %rax
movq %rax, 0x40(%rsp)
movaps 0x160(%rsp), %xmm1
movups %xmm1, 0x30(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x148(%rsp), %xmm1
movups %xmm1, 0x18(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x10(%rsp)
movapd 0x130(%rsp), %xmm1
movupd %xmm1, (%rsp)
leaq 0x70(%rsp), %r14
movq %r14, %rdi
callq 0x84d23
movl (%r14), %eax
testl %eax, %eax
je 0x85310
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
jle 0x8532f
leaq 0x148(%rsp), %rcx
leaq 0x130(%rsp), %rdx
movsd 0x10(%rcx), %xmm0
movsd (%rcx), %xmm1
movsd 0x8(%rcx), %xmm2
movsd 0x10(%rdx), %xmm6
movsd (%rdx), %xmm7
movsd 0x8(%rdx), %xmm8
movapd %xmm6, %xmm3
subsd %xmm0, %xmm3
movapd %xmm7, %xmm4
subsd %xmm1, %xmm4
movapd %xmm8, %xmm5
subsd %xmm2, %xmm5
mulsd %xmm5, %xmm5
mulsd %xmm4, %xmm4
addsd %xmm5, %xmm4
mulsd %xmm3, %xmm3
addsd %xmm4, %xmm3
sqrtsd %xmm3, %xmm3
addsd 0xcc440(%rip), %xmm3    # 0x151608
unpcklpd %xmm0, %xmm6            # xmm6 = xmm6[0],xmm0[0]
movapd %xmm6, 0xe0(%rsp)
unpcklpd %xmm1, %xmm7            # xmm7 = xmm7[0],xmm1[0]
movapd %xmm7, 0xd0(%rsp)
unpcklpd %xmm2, %xmm8            # xmm8 = xmm8[0],xmm2[0]
movapd %xmm8, 0xc0(%rsp)
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
movapd %xmm3, 0xb0(%rsp)
xorl %r13d, %r13d
movabsq $-0x5555555555555555, %rbp # imm = 0xAAAAAAAAAAAAAAAB
leaq 0x90(%rsp), %r12
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x78(%rsp), %rcx
movq 0x80(%rsp), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %rbp, %rdx
cmpq %r14, %rdx
jbe 0x85389
movups (%rcx,%r13), %xmm0
movaps %xmm0, 0x90(%rsp)
movq 0x10(%rcx,%r13), %rdx
movq %rdx, 0xa0(%rsp)
movapd 0x90(%rsp), %xmm0
movupd 0x98(%rsp), %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
subpd 0xd0(%rsp), %xmm0
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
subpd 0xc0(%rsp), %xmm1
movsd 0xa0(%rsp), %xmm2
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
subpd 0xe0(%rsp), %xmm2
mulpd %xmm1, %xmm1
mulpd %xmm0, %xmm0
addpd %xmm1, %xmm0
mulpd %xmm2, %xmm2
addpd %xmm0, %xmm2
sqrtpd %xmm2, %xmm0
cmpnlepd 0xb0(%rsp), %xmm0
movmskpd %xmm0, %edx
testl %edx, %edx
jne 0x852fb
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0x852e7
addq %r13, %rcx
movupd (%rcx), %xmm0
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsi)
movupd %xmm0, (%rsi)
addq $0x18, 0x58(%rsp)
jmp 0x852f4
leaq 0x50(%rsp), %rdi
movq %r12, %rdx
callq 0x2fec4
incl %r15d
movl 0x70(%rsp), %eax
incq %r14
movslq %eax, %rcx
addq $0x18, %r13
cmpq %rcx, %r14
jl 0x85219
jmp 0x85332
movl $0x0, (%rbx)
movupd 0x78(%rsp), %xmm0
movupd %xmm0, 0x8(%rbx)
movq 0x88(%rsp), %rax
movq %rax, 0x18(%rbx)
jmp 0x85374
xorl %r15d, %r15d
movl %r15d, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x50(%rsp), %rsi
callq 0xe868
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8535a
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x85374
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc8365(%rip), %rdi     # 0x14d6f5
movq %r14, %rsi
xorl %eax, %eax
callq 0x4630
jmp 0x8539e
jmp 0x8539e
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x853b8
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x853d2
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x4470
movq %rbx, %rdi
callq 0x4780