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

```asm
<my_cos>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  movsd  %xmm0,-0x38(%rbp)
  movsd  D3(%rip),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movsd  D66(%rip),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movl   $0x4,-0x2c(%rbp)
  pxor   %xmm0,%xmm0
  comisd -0x38(%rbp),%xmm0
  jbe    L39
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L11
L39:
  mov    $0x1,%edi
  call   <atan@plt>
  add    %eax,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  -0x38(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jbe    L4
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L11
L4:
  movsd  D37(%rip),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x38(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x10(%rbp),%xmm0
  divsd  -0x18(%rbp),%xmm0
  mulsd  -0x8(%rbp),%xmm0
  movsd  -0x28(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x8(%rbp),%xmm0
  movq   D38(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  jmp    L27
L20:
  movsd  -0x28(%rbp),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  mov    -0x38(%rbp),%rax
  mov    $0x2,%edi
  movq   %rax,%xmm0
  call   <pow@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  mulsd  -0x10(%rbp),%xmm0
  mulsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x40(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <my_fac@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm1
  mulsd  -0x18(%rbp),%xmm1
  movsd  -0x40(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movsd  -0x28(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  addl   $0x2,-0x2c(%rbp)
  movsd  -0x8(%rbp),%xmm0
  movq   D38(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <my_fac@plt>
  movsd  -0x18(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  mov    $0x2,%edi
  movq   %rax,%xmm0
  call   <pow@plt>
  movsd  -0x10(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
L27:
  movsd  -0x28(%rbp),%xmm0
  ucomisd -0x20(%rbp),%xmm0
  jp     L20
  movsd  -0x28(%rbp),%xmm0
  ucomisd -0x20(%rbp),%xmm0
  jne    L20
L11:
  movsd  -0x28(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D3
datatype: f64
name: read_data
arguments: data_label: D66
datatype: f32[2]
name: read_data
arguments: data_label: D5
datatype: string
name: read_data
arguments: data_label: D13
datatype: string
name: read_data
arguments: data_label: D37
datatype: f32[2]
name: read_data
arguments: data_label: D38
datatype: f32[2]

tool: D3: 1

tool: {"D66": [0.0,-1.875]}

tool: D5: Invalid x value: 0 <= x <= pi/2



tool: D13: usage: echo x value | ./p3

tool: {"D37": [0.0,2.0]}

tool: {"D38": [0.0,-0.0]}

assistant: ```c
double my_cos(double x) {
  double val1 = 1, val2 = 0, fac, term, sign = -1;
  int expnt = 4;
  if (x < 0) {
    printf("Invalid x value: 0 <= x <= pi/2\n\n");
    printf("usage: echo x value | ./p3");
    exit(1);
  } else if (x > (4 * atan(1) / 2)) {
    printf("Invalid x value: 0 <= x <= pi/2\n\n");
    printf("usage: echo x value | ./p3");
    exit(1);
  } else {
    fac = 2;
    term = x * x;
    val1 = val1 + sign * (term / fac);
    sign = -1 * sign;
    while (val1 != val2) {
      val2 = val1;
      val1 = val1 + sign * (term * pow(x, 2)) / (fac * my_fac(expnt));
      expnt = expnt + 2;
      sign = -1 * sign;
      fac = fac * my_fac(expnt);
      term = term * pow(x, 2);
    }
  }
  return val1;
}
```