user: Converte this assembly snippet into its equivalent C code:

```asm
<grad_to_D>:
  endbr64
  comisd D70(%rip),%xmm0
  push   %r12
  mov    %rdi,%r12
  movsd  D176(%rip),%xmm1
  jb     L213
  comisd %xmm0,%xmm1
  ja     L191
L213:
  comisd %xmm1,%xmm0
  movsd  D67(%rip),%xmm1
  jb     L158
  comisd %xmm0,%xmm1
  ja     L74
L158:
  comisd %xmm1,%xmm0
  movsd  D81(%rip),%xmm1
  jb     L16
  comisd %xmm0,%xmm1
  ja     L33
L16:
  comisd %xmm1,%xmm0
  movsd  D190(%rip),%xmm1
  jae    L178
L66:
  comisd %xmm1,%xmm0
  movsd  D25(%rip),%xmm1
  jb     L149
  comisd %xmm0,%xmm1
  ja     L217
L149:
  comisd %xmm1,%xmm0
  movsd  D157(%rip),%xmm1
  jb     L96
  comisd %xmm0,%xmm1
  ja     L98
L96:
  comisd %xmm1,%xmm0
  movsd  D26(%rip),%xmm1
  jb     L200
  comisd %xmm0,%xmm1
  jbe    L200
  lea    D99(%rip),%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
L50:
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   0x0(%rax)
L178:
  comisd %xmm0,%xmm1
  jbe    L66
  lea    D13(%rip),%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  jmp    L50
  nopw   0x0(%rax,%rax,1)
L200:
  comisd %xmm1,%xmm0
  jb     L103
  movsd  D141(%rip),%xmm1
  comisd %xmm0,%xmm1
  jb     L103
L194:
  mov    %r12,%rdi
  lea    D154(%rip),%rsi
  call   <strcpy@plt>
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   0x0(%rax)
L103:
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L18
  movsd  D70(%rip),%xmm2
  comisd %xmm0,%xmm2
  ja     L194
L122:
  lea    D82(%rip),%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  jmp    L50
  nopl   0x0(%rax)
L191:
  lea    D137(%rip),%rsi
  call   <strcpy@plt>
  mov    %r12,%rax
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L74:
  mov    %r12,%rdi
  lea    D31(%rip),%rsi
  call   <strcpy@plt>
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   (%rax)
L33:
  mov    %r12,%rdi
  lea    D55(%rip),%rsi
  call   <strcpy@plt>
  mov    %r12,%rax
  pop    %r12
  ret
  nopl   (%rax)
L18:
  ucomisd %xmm1,%xmm0
  jp     L122
  jne    L122
  lea    D43(%rip),%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  jmp    L50
  nopl   0x0(%rax)
L217:
  lea    D131(%rip),%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  jmp    L50
  nopl   0x0(%rax)
L98:
  lea    D12(%rip),%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  jmp    L50
```

tool_calls: name: retrieve_data
arguments: data_tag: D70
data_type: f64[2]
name: retrieve_data
arguments: data_tag: D176
data_type: f64
name: retrieve_data
arguments: data_tag: D67
data_type: f64
name: retrieve_data
arguments: data_tag: D81
data_type: f64
name: retrieve_data
arguments: data_tag: D190
data_type: f64
name: retrieve_data
arguments: data_tag: D25
data_type: f64
name: retrieve_data
arguments: data_tag: D157
data_type: f64
name: retrieve_data
arguments: data_tag: D26
data_type: f64
name: retrieve_data
arguments: data_tag: D99
data_type: string
name: retrieve_data
arguments: data_tag: D13
data_type: string
name: retrieve_data
arguments: data_tag: D141
data_type: f64
name: retrieve_data
arguments: data_tag: D154
data_type: string
name: retrieve_data
arguments: data_tag: D82
data_type: string
name: retrieve_data
arguments: data_tag: D137
data_type: string
name: retrieve_data
arguments: data_tag: D31
data_type: string
name: retrieve_data
arguments: data_tag: D55
data_type: string
name: retrieve_data
arguments: data_tag: D43
data_type: string
name: retrieve_data
arguments: data_tag: D131
data_type: string
name: retrieve_data
arguments: data_tag: D12
data_type: string

tool: {"D70": [22.5,67.5]}

tool: D176: 67.5

tool: D67: 112.5

tool: D81: 157.5

tool: D190: 202.5

tool: D25: 247.5

tool: D157: 292.5

tool: D26: 337.5

tool: D99: 7

tool: D13: 4

tool: D141: 360

tool: D154: 8

tool: D82: 9

tool: D137: 1

tool: D31: 2

tool: D55: 3

tool: D43: 0

tool: D131: 5

tool: D12: 6

assistant: ```c
char *grad_to_D(char *D, double grad) {
  if (grad >= 22.5 && grad < 67.5)
    strcpy(D, "1");
  else if (grad >= 67.5 && grad < 112.5)
    strcpy(D, "2");
  else if (grad >= 112.5 && grad < 157.5)
    strcpy(D, "3");
  else if (grad >= 157.5 && grad < 202.5)
    strcpy(D, "4");
  else if (grad >= 202.5 && grad < 247.5)
    strcpy(D, "5");
  else if (grad >= 247.5 && grad < 292.5)
    strcpy(D, "6");
  else if (grad >= 292.5 && grad < 337.5)
    strcpy(D, "7");
  else if ((grad >= 337.5 && grad <= 360.0) || (grad > 0.0 && grad < 22.5))
    strcpy(D, "8");
  else if (grad == 0.0)
    strcpy(D, "0");
  else
    strcpy(D, "9");
  return D;
}
```