// File: /workspace/github_cpp_makefile_star2_O3/j-faria[P]kima/src/Data.cpp
// Function: Data::topslope() const
double Data::topslope() const
{
  if (datamulti) {
    double slope = 0.0;
    for(size_t j=0; j<number_instruments; j++)
    {
      vector<double> obsy, obst;
      for (size_t i=0; i<y.size(); ++i) {
        if (obsi[i] == j + 1) {
          obsy.push_back(y[i]);
          obst.push_back(t[i]);
        }
      }
      const auto miny = std::min_element(obsy.begin(), obsy.end());
      const auto maxy = std::max_element(obsy.begin(), obsy.end());
      const auto mint = std::min_element(obst.begin(), obst.end());
      const auto maxt = std::max_element(obst.begin(), obst.end());
      double this_obs_topslope = (*maxy - *miny) / (*maxt - *mint);
      if (this_obs_topslope > slope)
        slope = this_obs_topslope;
    }
    return slope;
  }

  else {
    return get_RV_span() / get_timespan();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
cmpb $0x1, 0xf4(%rdi)
jne 0xb10d
cmpl $0x0, 0xf8(%rbx)
je 0xb12f
xorpd %xmm0, %xmm0
leaq 0x30(%rsp), %r15
xorl %r13d, %r13d
movsd %xmm0, 0x50(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
movq 0x18(%rbx), %rdx
movl $0x0, %eax
movl $0x0, %edi
movl $0x0, %ecx
movl $0x0, %esi
cmpq %rdx, 0x20(%rbx)
je 0xb023
leaq 0x1(%r13), %rbp
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x48(%rbx), %rax
movslq (%rax,%r14,4), %rax
cmpq %rax, %rbp
jne 0xaf8b
addq %r12, %rdx
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xaf54
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xaf5e
leaq 0x10(%rsp), %rdi
callq 0xc042
movq (%rbx), %rdx
addq %r12, %rdx
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0xaf83
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0xaf8b
movq %r15, %rdi
callq 0xc042
incq %r14
movq 0x18(%rbx), %rdx
movq 0x20(%rbx), %rax
subq %rdx, %rax
sarq $0x3, %rax
addq $0x8, %r12
cmpq %rax, %r14
jb 0xaf25
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rax
cmpq %rax, %rdi
sete %cl
movq %rdi, %rdx
addq $0x8, %rdx
cmpq %rax, %rdx
sete %sil
orb %cl, %sil
movq %rdi, %rcx
movq %rdi, %rsi
jne 0xb01e
movsd (%rdi), %xmm0
movapd %xmm0, %xmm1
movq %rdx, %rsi
movq %rdi, %rcx
movsd (%rsi), %xmm2
ucomisd %xmm2, %xmm1
cmovaq %rsi, %rcx
minsd %xmm1, %xmm2
addq $0x8, %rsi
movapd %xmm2, %xmm1
cmpq %rax, %rsi
jne 0xafe1
movq %rdi, %rsi
movsd (%rdx), %xmm1
ucomisd %xmm0, %xmm1
cmovaq %rdx, %rsi
maxsd %xmm0, %xmm1
addq $0x8, %rdx
movapd %xmm1, %xmm0
cmpq %rax, %rdx
jne 0xb001
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rdx
cmpq %rdx, %rax
sete %r8b
leaq 0x8(%rax), %r9
cmpq %rdx, %r9
sete %r10b
orb %r8b, %r10b
movq %rax, %r8
movq %rax, %r10
jne 0xb092
movsd (%rax), %xmm0
movapd %xmm0, %xmm1
movq %r9, %r10
movq %rax, %r8
movsd (%r10), %xmm2
ucomisd %xmm2, %xmm1
cmovaq %r10, %r8
minsd %xmm1, %xmm2
addq $0x8, %r10
movapd %xmm2, %xmm1
cmpq %rdx, %r10
jne 0xb053
movq %rax, %r10
movsd (%r9), %xmm1
ucomisd %xmm0, %xmm1
cmovaq %r9, %r10
maxsd %xmm0, %xmm1
addq $0x8, %r9
movapd %xmm1, %xmm0
cmpq %rdx, %r9
jne 0xb074
movsd (%rsi), %xmm1
subsd (%rcx), %xmm1
movsd (%r10), %xmm0
subsd (%r8), %xmm0
movsd %xmm0, 0x48(%rsp)
testq %rax, %rax
movsd %xmm1, 0x8(%rsp)
je 0xb0d0
movq 0x40(%rsp), %rsi
subq %rax, %rsi
movq %rax, %rdi
callq 0x6460
movsd 0x8(%rsp), %xmm1
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb0e8
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movsd 0x8(%rsp), %xmm1
divsd 0x48(%rsp), %xmm1
maxsd 0x50(%rsp), %xmm1
incq %r13
movslq 0xf8(%rbx), %rax
movapd %xmm1, %xmm0
cmpq %rax, %r13
jb 0xaed7
jmp 0xb133
movq %rbx, %rdi
callq 0xb180
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0xbe0a
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
jmp 0xb133
xorpd %xmm1, %xmm1
movapd %xmm1, %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xb160
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb177
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq %rbx, %rdi
callq 0x6710
nop