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

```asm
<ti_atr>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rcx,(%rsp)
  cvttsd2si (%rdx),%r15d
  mov    $0x1,%eax
  test   %r15d,%r15d
  jle    L48
  mov    %edi,%ebx
  mov    %rdx,%r14
  mov    (%rsi),%rbp
  mov    0x8(%rsi),%r12
  mov    0x10(%rsi),%r13
  mov    (%rcx),%rax
  mov    %rax,0x8(%rsp)
  mov    %rdx,%rdi
  call   <ti_atr_start@plt>
  mov    %eax,%edx
  mov    $0x0,%eax
  cmp    %ebx,%edx
  jge    L48
  pxor   %xmm8,%xmm8
  cvtsi2sd %r15d,%xmm8
  movsd  D11(%rip),%xmm4
  divsd  %xmm8,%xmm4
  movsd  0x0(%rbp),%xmm1
  subsd  (%r12),%xmm1
  addsd  D3(%rip),%xmm1
  cmp    $0x1,%r15d
  jle    L58
  mov    %r15d,%edx
  mov    $0x1,%eax
  movq   D1(%rip),%xmm7
L51:
  movsd  (%r12,%rax,8),%xmm5
  movsd  0x0(%rbp,%rax,8),%xmm0
  movsd  -0x8(%r13,%rax,8),%xmm6
  movapd %xmm0,%xmm3
  subsd  %xmm6,%xmm3
  andpd  %xmm7,%xmm3
  movapd %xmm5,%xmm2
  subsd  %xmm6,%xmm2
  andpd  %xmm7,%xmm2
  subsd  %xmm5,%xmm0
  maxsd  %xmm0,%xmm3
  maxsd  %xmm3,%xmm2
  addsd  %xmm2,%xmm1
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L51
L58:
  divsd  %xmm8,%xmm1
  mov    0x8(%rsp),%rdi
  lea    0x8(%rdi),%rcx
  movsd  %xmm1,(%rdi)
  cmp    %ebx,%r15d
  jge    L33
  movslq %r15d,%rax
  mov    %rax,%rdx
  neg    %rdx
  lea    (%rdi,%rdx,8),%rdx
  movq   D1(%rip),%xmm7
L41:
  movsd  (%r12,%rax,8),%xmm5
  movsd  0x0(%rbp,%rax,8),%xmm0
  movsd  -0x8(%r13,%rax,8),%xmm6
  movapd %xmm0,%xmm3
  subsd  %xmm6,%xmm3
  andpd  %xmm7,%xmm3
  movapd %xmm5,%xmm2
  subsd  %xmm6,%xmm2
  andpd  %xmm7,%xmm2
  subsd  %xmm5,%xmm0
  maxsd  %xmm0,%xmm3
  maxsd  %xmm3,%xmm2
  movapd %xmm2,%xmm0
  subsd  %xmm1,%xmm0
  mulsd  %xmm4,%xmm0
  addsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%ebx
  jg     L41
  lea    -0x1(%rbx),%eax
  sub    %r15d,%eax
  lea    0x8(%rcx,%rax,8),%rcx
L33:
  mov    (%rsp),%rax
  sub    (%rax),%rcx
  sar    $0x3,%rcx
  mov    %rcx,%rbp
  mov    %r14,%rdi
  call   <ti_atr_start@plt>
  sub    %eax,%ebx
  movslq %ebx,%rbx
  cmp    %rbp,%rbx
  sete   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    $0x0,%eax
L48:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: label: D11
datatype: f64
name: disassemble_data
arguments: label: D3
datatype: f64
name: disassemble_data
arguments: label: D1
datatype: qword

tool: D11: 1

tool: D3: 0

tool: D1: 9223372036854775807

assistant: ```c
int ti_atr(int size, double const *const *inputs, double const *options, double *const *outputs) {
  const double *high = inputs[0];
  const double *low = inputs[1];
  const double *close = inputs[2];
  const int period = (int)options[0];
  double *output = outputs[0];
  if (period < 1)
    return 1;
  if (size <= ti_atr_start(options))
    return 0;
  const double per = 1.0 / ((double)period);
  double sum = 0;
  double truerange;
  sum += high[0] - low[0];
  int i;
  for (i = 1; i < period; ++i) {
    do {
      const double l = low[i];
      const double h = high[i];
      const double c = close[i - 1];
      const double ych = fabs(h - c);
      const double ycl = fabs(l - c);
      double v = h - l;
      if (ych > v)
        v = ych;
      if (ycl > v)
        v = ycl;
      truerange = v;
    } while (0);
    sum += truerange;
  }
  double val = sum / period;
  *output++ = val;
  for (i = period; i < size; ++i) {
    do {
      const double l = low[i];
      const double h = high[i];
      const double c = close[i - 1];
      const double ych = fabs(h - c);
      const double ycl = fabs(l - c);
      double v = h - l;
      if (ych > v)
        v = ych;
      if (ycl > v)
        v = ycl;
      truerange = v;
    } while (0);
    val = (truerange - val) * per + val;
    *output++ = val;
  }
  assert(output - outputs[0] == size - ti_atr_start(options));
  return 0;
}
```