// File: /workspace/github_cpp_makefile_star2_O1/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 0xb045
cmpl $0x0, 0xf8(%rbx)
je 0xb067
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
cmpq %rdx, 0x20(%rbx)
je 0xaef0
leaq 0x1(%r13), %rbp
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x48(%rbx), %rax
movslq (%rax,%r14,4), %rax
cmpq %rax, %rbp
jne 0xaed1
addq %r12, %rdx
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xae9a
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0xaea4
leaq 0x10(%rsp), %rdi
callq 0xbf7a
movq (%rbx), %rdx
addq %r12, %rdx
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0xaec9
movsd (%rdx), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0xaed1
movq %r15, %rdi
callq 0xbf7a
incq %r14
movq 0x18(%rbx), %rdx
movq 0x20(%rbx), %rax
subq %rdx, %rax
sarq $0x3, %rax
addq $0x8, %r12
cmpq %rax, %r14
jb 0xae6b
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rdx
cmpq %rdx, %rdi
sete %al
movq %rdi, %rsi
addq $0x8, %rsi
cmpq %rdx, %rsi
sete %cl
orb %al, %cl
movq %rdi, %rax
jne 0xaf38
movq %rsi, %r8
movq %rdi, %r9
movsd (%r9), %xmm0
ucomisd (%r8), %xmm0
movq %r8, %rax
ja 0xaf2c
movq %r9, %rax
addq $0x8, %r8
movq %rax, %r9
cmpq %rdx, %r8
jne 0xaf1a
testb %cl, %cl
je 0xaf41
movq %rdi, %rcx
jmp 0xaf5d
movsd (%rsi), %xmm0
ucomisd (%rdi), %xmm0
movq %rsi, %rcx
ja 0xaf51
movq %rdi, %rcx
addq $0x8, %rsi
movq %rcx, %rdi
cmpq %rdx, %rsi
jne 0xaf41
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rdx
cmpq %rdx, %rdi
sete %r8b
leaq 0x8(%rdi), %rsi
cmpq %rdx, %rsi
sete %r9b
orb %r8b, %r9b
movq %rdi, %r8
jne 0xafa5
movq %rsi, %r10
movq %rdi, %r11
movsd (%r11), %xmm0
ucomisd (%r10), %xmm0
movq %r10, %r8
ja 0xaf99
movq %r11, %r8
addq $0x8, %r10
movq %r8, %r11
cmpq %rdx, %r10
jne 0xaf87
movq %rdi, %r10
testb %r9b, %r9b
jne 0xafcd
movq %rdi, %r9
movsd (%rsi), %xmm0
ucomisd (%r9), %xmm0
movq %rsi, %r10
ja 0xafc1
movq %r9, %r10
addq $0x8, %rsi
movq %r10, %r9
cmpq %rdx, %rsi
jne 0xafb0
movsd (%rcx), %xmm1
subsd (%rax), %xmm1
movsd (%r10), %xmm0
subsd (%r8), %xmm0
movsd %xmm0, 0x48(%rsp)
testq %rdi, %rdi
movsd %xmm1, 0x8(%rsp)
je 0xb003
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movsd 0x8(%rsp), %xmm1
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb020
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 0xae31
jmp 0xb06b
movq %rbx, %rdi
callq 0xb0b8
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0xbd48
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
jmp 0xb06b
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 0xb098
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb0af
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x6460
movq %rbx, %rdi
callq 0x6710
nop