user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<dd_cos>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x110,%rsp
  mov    %rdi,-0x108(%rbp)
  mov    %rsi,-0x110(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x108(%rbp),%rax
  mov    %rax,%rdi
  call   <dd_is_zero@plt>
  cmp    $0x1,%eax
  jne    L101
  mov    -0x110(%rbp),%rax
  movsd  D17(%rip),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x110(%rbp),%rax
  add    $0x8,%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L39
L101:
  lea    -0xf4(%rbp),%r8
  lea    -0xf8(%rbp),%rdi
  lea    -0xfc(%rbp),%rcx
  lea    -0x100(%rbp),%rdx
  lea    -0xf0(%rbp),%rsi
  mov    -0x108(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <dd_reduce_modulo_2pi@plt>
  mov    -0xf4(%rbp),%eax
  cmp    $0x1,%eax
  jne    L114
  mov    -0x110(%rbp),%rax
  movsd  D13(%rip),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x110(%rbp),%rax
  add    $0x8,%rax
  pxor   %xmm0,%xmm0
  movsd  %xmm0,(%rax)
  jmp    L39
L114:
  mov    -0xfc(%rbp),%eax
  test   %eax,%eax
  jne    L75
  mov    -0x100(%rbp),%eax
  test   %eax,%eax
  jne    L4
  mov    -0x110(%rbp),%rdx
  lea    -0xf0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_cos_taylor@plt>
  jmp    L39
L4:
  mov    -0x100(%rbp),%eax
  cmp    $0x1,%eax
  jne    L116
  mov    -0x110(%rbp),%rdx
  lea    -0xf0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_sin_taylor@plt>
  mov    -0x110(%rbp),%rax
  mov    %rax,%rdi
  call   <dd_minus@plt>
  jmp    L39
L116:
  mov    -0x100(%rbp),%eax
  cmp    $0xffffffff,%eax
  jne    L112
  mov    -0x110(%rbp),%rdx
  lea    -0xf0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_sin_taylor@plt>
  jmp    L39
L112:
  mov    -0x110(%rbp),%rdx
  lea    -0xf0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_cos_taylor@plt>
  mov    -0x110(%rbp),%rax
  mov    %rax,%rdi
  call   <dd_minus@plt>
  jmp    L39
L75:
  lea    -0x30(%rbp),%rcx
  lea    -0x50(%rbp),%rdx
  lea    -0x70(%rbp),%rsi
  lea    -0x90(%rbp),%rax
  mov    %rax,%rdi
  call   <sincostables@plt>
  mov    -0xf8(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movsd  -0x50(%rbp,%rax,8),%xmm0
  movsd  %xmm0,-0xe0(%rbp)
  mov    -0xf8(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movsd  -0x30(%rbp,%rax,8),%xmm0
  movsd  %xmm0,-0xd8(%rbp)
  mov    -0xf8(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movsd  -0x90(%rbp,%rax,8),%xmm0
  movsd  %xmm0,-0xd0(%rbp)
  mov    -0xf8(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movsd  -0x70(%rbp,%rax,8),%xmm0
  movsd  %xmm0,-0xc8(%rbp)
  lea    -0xa0(%rbp),%rdx
  lea    -0xb0(%rbp),%rcx
  lea    -0xf0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_sincos_taylor@plt>
  mov    -0x100(%rbp),%eax
  test   %eax,%eax
  jne    L21
  mov    -0x110(%rbp),%rdx
  lea    -0xa0(%rbp),%rcx
  lea    -0xe0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_mul@plt>
  lea    -0xc0(%rbp),%rdx
  lea    -0xb0(%rbp),%rcx
  lea    -0xd0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_mul@plt>
  mov    -0xfc(%rbp),%eax
  test   %eax,%eax
  jle    L169
  lea    -0xc0(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_dec@plt>
  jmp    L39
L169:
  lea    -0xc0(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_inc@plt>
  jmp    L39
L21:
  mov    -0x100(%rbp),%eax
  cmp    $0x1,%eax
  jne    L180
  mov    -0x110(%rbp),%rdx
  lea    -0xa0(%rbp),%rcx
  lea    -0xd0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_mul@plt>
  lea    -0xc0(%rbp),%rdx
  lea    -0xb0(%rbp),%rcx
  lea    -0xe0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_mul@plt>
  mov    -0xfc(%rbp),%eax
  test   %eax,%eax
  jle    L17
  mov    -0x110(%rbp),%rax
  mov    %rax,%rdi
  call   <dd_minus@plt>
  lea    -0xc0(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_dec@plt>
  jmp    L39
L17:
  lea    -0xc0(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_dec@plt>
  jmp    L39
L180:
  mov    -0x100(%rbp),%eax
  cmp    $0xffffffff,%eax
  jne    L189
  mov    -0x110(%rbp),%rdx
  lea    -0xb0(%rbp),%rcx
  lea    -0xe0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_mul@plt>
  lea    -0xc0(%rbp),%rdx
  lea    -0xa0(%rbp),%rcx
  lea    -0xd0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_mul@plt>
  mov    -0xfc(%rbp),%eax
  test   %eax,%eax
  jle    L81
  lea    -0xc0(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_inc@plt>
  jmp    L39
L81:
  lea    -0xc0(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_dec@plt>
  jmp    L39
L189:
  mov    -0x110(%rbp),%rdx
  lea    -0xb0(%rbp),%rcx
  lea    -0xd0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_mul@plt>
  lea    -0xc0(%rbp),%rdx
  lea    -0xa0(%rbp),%rcx
  lea    -0xe0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <dd_mul@plt>
  mov    -0xfc(%rbp),%eax
  test   %eax,%eax
  jle    L135
  lea    -0xc0(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_dec@plt>
  jmp    L39
L135:
  mov    -0x110(%rbp),%rax
  mov    %rax,%rdi
  call   <dd_minus@plt>
  lea    -0xc0(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <dd_dec@plt>
L39:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L56
  call   <__stack_chk_fail@plt>
L56:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D17
datatype: f64
name: retrieve_data
arguments: tag: D13
datatype: f32[2]

tool: D17: 1

tool: {"D13": [0.0,-2.0]}

assistant: ```c
void dd_cos(const double *a, double *cos_a) {
  if (dd_is_zero(a) == 1) {
    cos_a[0] = 1.0;
    cos_a[1] = 0.0;
  } else {
    double t[2];
    int j, k, abs_k, fail;
    dd_reduce_modulo_2pi(a, t, &j, &k, &abs_k, &fail);
    if (fail == 1) {
      cos_a[0] = -2.0;
      cos_a[1] = 0.0;
    } else if (k == 0) {
      if (j == 0) {
        dd_cos_taylor(t, cos_a);
      } else if (j == 1) {
        dd_sin_taylor(t, cos_a);
        dd_minus(cos_a);
      } else if (j == -1) {
        dd_sin_taylor(t, cos_a);
      } else {
        dd_cos_taylor(t, cos_a);
        dd_minus(cos_a);
      }
    } else {
      double u[2], v[2], w[2], t_sin[2], t_cos[2];
      double sintabhi[4], sintablo[4];
      double costabhi[4], costablo[4];
      sincostables(sintabhi, sintablo, costabhi, costablo);
      u[0] = costabhi[abs_k - 1];
      u[1] = costablo[abs_k - 1];
      v[0] = sintabhi[abs_k - 1];
      v[1] = sintablo[abs_k - 1];
      dd_sincos_taylor(t, t_sin, t_cos);
      if (j == 0) {
        dd_mul(u, t_cos, cos_a);
        dd_mul(v, t_sin, w);
        if (k > 0)
          dd_dec(cos_a, w);
        else
          dd_inc(cos_a, w);
      } else if (j == 1) {
        dd_mul(v, t_cos, cos_a);
        dd_mul(u, t_sin, w);
        if (k > 0) {
          dd_minus(cos_a);
          dd_dec(cos_a, w);
        } else {
          dd_dec(cos_a, w);
        }
      } else if (j == -1) {
        dd_mul(u, t_sin, cos_a);
        dd_mul(v, t_cos, w);
        if (k > 0)
          dd_inc(cos_a, w);
        else
          dd_dec(cos_a, w);
      } else {
        dd_mul(v, t_sin, cos_a);
        dd_mul(u, t_cos, w);
        if (k > 0) {
          dd_dec(cos_a, w);
        } else {
          dd_minus(cos_a);
          dd_dec(cos_a, w);
        }
      }
    }
  }
}
```