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

```asm
<ti_atr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %edi,-0xc4(%rbp)
  mov    %rsi,-0xd0(%rbp)
  mov    %rdx,-0xd8(%rbp)
  mov    %rcx,-0xe0(%rbp)
  mov    -0xd0(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x88(%rbp)
  mov    -0xd0(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x80(%rbp)
  mov    -0xd0(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,-0x78(%rbp)
  mov    -0xd8(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0xb4(%rbp)
  mov    -0xe0(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0xb0(%rbp)
  cmpl   $0x0,-0xb4(%rbp)
  jg     L39
  mov    $0x1,%eax
  jmp    L54
L39:
  mov    -0xd8(%rbp),%rax
  mov    %rax,%rdi
  call   <ti_atr_start@plt>
  cmp    %eax,-0xc4(%rbp)
  jg     L41
  mov    $0x0,%eax
  jmp    L54
L41:
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0xb4(%rbp),%xmm1
  movsd  D23(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x70(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0xa8(%rbp)
  mov    -0x88(%rbp),%rax
  movsd  (%rax),%xmm0
  mov    -0x80(%rbp),%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  -0xa8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0xa8(%rbp)
  movl   $0x1,-0xb8(%rbp)
  jmp    L87
L49:
  mov    -0xb8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  mov    -0xb8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0xb8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x30(%rbp),%xmm0
  subsd  -0x28(%rbp),%xmm0
  movq   D28(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movsd  -0x38(%rbp),%xmm0
  subsd  -0x28(%rbp),%xmm0
  movq   D28(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x30(%rbp),%xmm0
  subsd  -0x38(%rbp),%xmm0
  movsd  %xmm0,-0xa0(%rbp)
  movsd  -0x20(%rbp),%xmm0
  comisd -0xa0(%rbp),%xmm0
  jbe    L75
  movsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0xa0(%rbp)
L75:
  movsd  -0x18(%rbp),%xmm0
  comisd -0xa0(%rbp),%xmm0
  jbe    L26
  movsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0xa0(%rbp)
L26:
  movsd  -0xa0(%rbp),%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movsd  -0xa8(%rbp),%xmm0
  addsd  -0x40(%rbp),%xmm0
  movsd  %xmm0,-0xa8(%rbp)
  addl   $0x1,-0xb8(%rbp)
L87:
  mov    -0xb8(%rbp),%eax
  cmp    -0xb4(%rbp),%eax
  jl     L49
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0xb4(%rbp),%xmm1
  movsd  -0xa8(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x98(%rbp)
  mov    -0xb0(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0xb0(%rbp)
  movsd  -0x98(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0xb4(%rbp),%eax
  mov    %eax,-0xb8(%rbp)
  jmp    L82
L60:
  mov    -0xb8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x80(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x68(%rbp)
  mov    -0xb8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x60(%rbp)
  mov    -0xb8(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x58(%rbp)
  movsd  -0x60(%rbp),%xmm0
  subsd  -0x58(%rbp),%xmm0
  movq   D28(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movsd  %xmm0,-0x50(%rbp)
  movsd  -0x68(%rbp),%xmm0
  subsd  -0x58(%rbp),%xmm0
  movq   D28(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movsd  %xmm0,-0x48(%rbp)
  movsd  -0x60(%rbp),%xmm0
  subsd  -0x68(%rbp),%xmm0
  movsd  %xmm0,-0x90(%rbp)
  movsd  -0x50(%rbp),%xmm0
  comisd -0x90(%rbp),%xmm0
  jbe    L43
  movsd  -0x50(%rbp),%xmm0
  movsd  %xmm0,-0x90(%rbp)
L43:
  movsd  -0x48(%rbp),%xmm0
  comisd -0x90(%rbp),%xmm0
  jbe    L92
  movsd  -0x48(%rbp),%xmm0
  movsd  %xmm0,-0x90(%rbp)
L92:
  movsd  -0x90(%rbp),%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movsd  -0x40(%rbp),%xmm0
  subsd  -0x98(%rbp),%xmm0
  mulsd  -0x70(%rbp),%xmm0
  movsd  -0x98(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x98(%rbp)
  mov    -0xb0(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0xb0(%rbp)
  movsd  -0x98(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0xb8(%rbp)
L82:
  mov    -0xb8(%rbp),%eax
  cmp    -0xc4(%rbp),%eax
  jl     L60
  mov    -0xe0(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0xb0(%rbp),%rax
  sub    %rdx,%rax
  sar    $0x3,%rax
  mov    %rax,%rbx
  mov    -0xd8(%rbp),%rax
  mov    %rax,%rdi
  call   <ti_atr_start@plt>
  mov    %eax,%edx
  mov    -0xc4(%rbp),%eax
  sub    %edx,%eax
  cltq
  cmp    %rax,%rbx
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    $0x0,%eax
L54:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D23
type: f64
name: disassemble_data
arguments: label: D28
type: qword

tool: D23: 1

tool: D28: 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;
}
```