user: Translate the below assembly code into C programming language:

```asm
<ti_aroonosc>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdx,(%rsp)
  mov    %rcx,0x8(%rsp)
  cvttsd2si (%rdx),%r14d
  mov    $0x1,%eax
  test   %r14d,%r14d
  jle    L124
  mov    %edi,%r12d
  mov    %rdx,%rdi
  mov    (%rsi),%rbx
  mov    0x8(%rsi),%rbp
  mov    (%rcx),%r13
  call   <ti_aroon_start@plt>
  mov    %eax,%edx
  mov    $0x0,%eax
  cmp    %r12d,%edx
  jge    L124
  pxor   %xmm0,%xmm0
  cvtsi2sd %r14d,%xmm0
  movsd  D2(%rip),%xmm3
  divsd  %xmm0,%xmm3
  movsd  (%rbx),%xmm1
  movsd  0x0(%rbp),%xmm2
  cmp    %r12d,%r14d
  jge    L83
  movslq %r14d,%rcx
  mov    %r12d,%r15d
  sub    %r14d,%r15d
  mov    $0x1,%edi
  mov    $0xffffffff,%r9d
  mov    $0xffffffff,%r8d
  mov    $0x0,%esi
  jmp    L216
L65:
  movsd  -0x8(%rbx,%rdi,8),%xmm1
  mov    %ecx,%r10d
  cmp    %edi,%ecx
  jl     L172
  mov    %edi,%eax
  movslq %edi,%rdx
  mov    %esi,%r8d
  jmp    L227
L249:
  add    $0x1,%rdx
  cmp    %edx,%r10d
  jl     L69
L227:
  movsd  (%rbx,%rdx,8),%xmm0
  comisd %xmm1,%xmm0
  jb     L249
  movapd %xmm0,%xmm1
  mov    %edx,%r8d
  jmp    L249
L60:
  movsd  -0x8(%rbp,%rdi,8),%xmm2
  mov    %edi,%eax
  cmp    %ecx,%edi
  jg     L211
L49:
  cltq
  mov    %esi,%r9d
  jmp    L171
L7:
  add    $0x1,%rax
  cmp    %ecx,%eax
  jg     L144
L171:
  movsd  0x0(%rbp,%rax,8),%xmm0
  comisd %xmm0,%xmm2
  jb     L7
  movapd %xmm0,%xmm2
  mov    %eax,%r9d
  jmp    L7
L211:
  mov    %esi,%r9d
L144:
  mov    %r8d,%eax
  sub    %r9d,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,-0x8(%r13,%rdi,8)
  add    $0x1,%esi
  add    $0x1,%rdi
  add    $0x1,%rcx
  cmp    %r15d,%esi
  je     L12
L216:
  mov    %ecx,%r11d
  movsd  (%rbx,%rcx,8),%xmm0
  cmp    %r8d,%esi
  jg     L65
  comisd %xmm1,%xmm0
  jb     L168
  movapd %xmm0,%xmm1
  mov    %ecx,%r8d
L168:
  cmp    %r9d,%esi
  jg     L60
L106:
  movsd  0x0(%rbp,%rcx,8),%xmm0
L184:
  comisd %xmm0,%xmm2
  jb     L144
  movapd %xmm0,%xmm2
  mov    %r11d,%r9d
  jmp    L144
L12:
  lea    -0x1(%r12),%eax
  sub    %r14d,%eax
  lea    0x8(%r13,%rax,8),%r13
L83:
  mov    0x8(%rsp),%rax
  sub    (%rax),%r13
  sar    $0x3,%r13
  mov    (%rsp),%rdi
  call   <ti_aroonosc_start@plt>
  sub    %eax,%r12d
  movslq %r12d,%r12
  cmp    %r13,%r12
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0x0,%eax
L124:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L240:
  movsd  -0x8(%rbp,%rdi,8),%xmm2
  jmp    L49
L69:
  cmp    %r9d,%esi
  jg     L240
  movsd  0x0(%rbp,%rcx,8),%xmm0
  jmp    L184
L172:
  mov    %esi,%r8d
  cmp    %r9d,%esi
  jle    L106
  movsd  -0x8(%rbp,%rdi,8),%xmm2
  mov    %esi,%r8d
  mov    %esi,%r9d
  jmp    L144
```

tool_calls: name: parse_data
arguments: data_tag: D2
datatype: f64

tool: D2: 100

assistant: ```c
int ti_aroonosc(int size, double const *const *inputs, double const *options, double *const *outputs) {
  const double *high = inputs[0];
  const double *low = inputs[1];
  double *output = outputs[0];
  const int period = (int)options[0];
  if (period < 1)
    return 1;
  if (size <= ti_aroon_start(options))
    return 0;
  const double scale = 100.0 / period;
  int trail = 0, maxi = -1, mini = -1;
  double max = high[0];
  double min = low[0];
  int i, j;
  for (i = period; i < size; ++i, ++trail) {
    double bar = high[i];
    if (maxi < trail) {
      maxi = trail;
      max = high[maxi];
      j = trail;
      while (++j <= i) {
        bar = high[j];
        if (bar >= max) {
          max = bar;
          maxi = j;
        }
      }
    } else if (bar >= max) {
      maxi = i;
      max = bar;
    }
    bar = low[i];
    if (mini < trail) {
      mini = trail;
      min = low[mini];
      j = trail;
      while (++j <= i) {
        bar = low[j];
        if (bar <= min) {
          min = bar;
          mini = j;
        }
      }
    } else if (bar <= min) {
      mini = i;
      min = bar;
    }
    *output++ = (maxi - mini) * scale;
  }
  assert(output - outputs[0] == size - ti_aroonosc_start(options));
  return 0;
}
```