user: Please show me the C implementation that matches the assembly code listed below:

```asm
<atan>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x28(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L70
  mov    $0x1,%eax
  jmp    L105
L70:
  mov    $0xffffffff,%eax
L105:
  mov    %eax,-0x1c(%rbp)
  movsd  -0x28(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L19
  movsd  -0x28(%rbp),%xmm0
  jmp    L125
L19:
  movsd  -0x28(%rbp),%xmm0
  movq   D117(%rip),%xmm1
  xorpd  %xmm1,%xmm0
L125:
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x28(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L76
  movsd  D123(%rip),%xmm0
  comisd -0x28(%rbp),%xmm0
  jb     L76
  pxor   %xmm5,%xmm5
  cvtsi2sdl -0x1c(%rbp),%xmm5
  movsd  %xmm5,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  movq   %rax,%xmm0
  call   <__arctan_sub@plt>
  mulsd  -0x30(%rbp),%xmm0
  jmp    L72
L76:
  movsd  -0x28(%rbp),%xmm0
  comisd D123(%rip),%xmm0
  jbe    L71
  movsd  D82(%rip),%xmm0
  comisd -0x28(%rbp),%xmm0
  jb     L71
  movsd  D82(%rip),%xmm0
  subsd  -0x28(%rbp),%xmm0
  movsd  -0x28(%rbp),%xmm2
  movsd  D82(%rip),%xmm1
  addsd  %xmm2,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  pxor   %xmm3,%xmm3
  cvtsi2sdl -0x1c(%rbp),%xmm3
  movsd  %xmm3,-0x30(%rbp)
  mov    -0x18(%rbp),%rax
  movq   %rax,%xmm0
  call   <__arctan_sub@plt>
  movsd  D110(%rip),%xmm1
  subsd  %xmm0,%xmm1
  movsd  -0x30(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  jmp    L72
L71:
  movsd  -0x28(%rbp),%xmm0
  movsd  D82(%rip),%xmm1
  comisd %xmm1,%xmm0
  jb     L118
  movsd  D62(%rip),%xmm0
  comisd -0x28(%rbp),%xmm0
  jb     L118
  movsd  -0x28(%rbp),%xmm0
  movsd  D82(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  -0x28(%rbp),%xmm2
  movsd  D82(%rip),%xmm1
  addsd  %xmm2,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  pxor   %xmm6,%xmm6
  cvtsi2sdl -0x1c(%rbp),%xmm6
  movsd  %xmm6,-0x30(%rbp)
  mov    -0x10(%rbp),%rax
  movq   %rax,%xmm0
  call   <__arctan_sub@plt>
  movsd  D110(%rip),%xmm1
  addsd  %xmm1,%xmm0
  mulsd  -0x30(%rbp),%xmm0
  jmp    L72
L118:
  movsd  D82(%rip),%xmm0
  divsd  -0x28(%rbp),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  pxor   %xmm4,%xmm4
  cvtsi2sdl -0x1c(%rbp),%xmm4
  movsd  %xmm4,-0x30(%rbp)
  mov    -0x8(%rbp),%rax
  movq   %rax,%xmm0
  call   <__arctan_sub@plt>
  movsd  D3(%rip),%xmm1
  subsd  %xmm0,%xmm1
  movsd  -0x30(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
L72:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D117
datatype: f32[2]
name: unpack_data
arguments: data_label: D123
datatype: f64[2]
name: unpack_data
arguments: data_label: D82
datatype: f64
name: unpack_data
arguments: data_label: D110
datatype: f64
name: unpack_data
arguments: data_label: D62
datatype: f64
name: unpack_data
arguments: data_label: D3
datatype: f64

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

tool: {"D123": [0.41421356,1.0]}

tool: D82: 1

tool: D110: 0.7853981

tool: D62: 2.41421356

tool: D3: 1.5707963

assistant: ```c
double atan(double x) {
  int sign;
  sign = x >= 0 ? 1 : -1;
  x = x >= 0 ? x : -x;
  if (0.0 <= x && x <= 0.41421356) {
    return sign * __arctan_sub(x);
  } else if (0.41421356 < x && x <= 1.0) {
    double tmp;
    tmp = (1.0 - x) / (1.0 + x);
    return sign * (0.7853981 - __arctan_sub(tmp));
  } else if (1.0 <= x && x <= 2.41421356) {
    double tmp;
    tmp = (x - 1.0) / (x + 1.0);
    return sign * (0.7853981 + __arctan_sub(tmp));
  } else {
    double tmp;
    tmp = 1.0 / x;
    return sign * (1.5707963 - __arctan_sub(tmp));
  }
}
```