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

```asm
<unpackgrid>:
  endbr64
  sub    $0x38,%rsp
  movdqa D29(%rip),%xmm0
  mov    %edi,%edx
  mov    %rsi,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %edx,%esi
  movl   $0x5a595857,0x20(%rsp)
  movaps %xmm0,(%rsp)
  movdqa D25(%rip),%xmm0
  sar    $0x7,%esi
  movb   $0x20,0x24(%rsp)
  movaps %xmm0,0x10(%rsp)
  cmp    $0x3f47ff,%edx
  jg     L9
  movslq %esi,%rax
  sar    $0x1f,%edx
  pxor   %xmm1,%xmm1
  movsd  D60(%rip),%xmm0
  imul   $0xffffffffb60b60b7,%rax,%rax
  shr    $0x20,%rax
  add    %esi,%eax
  sar    $0x7,%eax
  mov    %eax,%ecx
  sub    %edx,%eax
  sub    %edx,%ecx
  lea    -0xb2(%rax,%rax,1),%eax
  imul   $0xb4,%ecx,%r8d
  mov    %esi,%ecx
  lea    0x168(%rax),%edx
  sub    %r8d,%ecx
  cmp    $0xffffff4c,%eax
  cmovl  %edx,%eax
  cvtsi2sd %eax,%xmm1
  subsd  %xmm1,%xmm0
  movsd  D20(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  divsd  D64(%rip),%xmm0
  cvttsd2si %xmm0,%edx
  pxor   %xmm0,%xmm0
  cvtsi2sd %ecx,%xmm0
  movslq %edx,%rax
  mov    %edx,%esi
  imul   $0xffffffff88888889,%rax,%rax
  mulsd  %xmm1,%xmm0
  sar    $0x1f,%esi
  divsd  D1(%rip),%xmm0
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x7,%eax
  sub    %esi,%eax
  lea    0xa(%rax),%esi
  movslq %esi,%rsi
  movzbl (%rsp,%rsi,1),%esi
  mov    %sil,(%rdi)
  mov    %eax,%esi
  shl    $0x4,%esi
  sub    %esi,%eax
  shl    $0x4,%eax
  add    %edx,%eax
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x2aaaaaab,%rdx,%rdx
  sar    $0x22,%rdx
  sub    %eax,%edx
  movslq %edx,%rax
  cvttsd2si %xmm0,%edx
  movzbl (%rsp,%rax,1),%eax
  mov    %al,0x2(%rdi)
  movslq %edx,%rax
  mov    %edx,%ecx
  imul   $0xffffffff88888889,%rax,%rax
  sar    $0x1f,%ecx
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x7,%eax
  sub    %ecx,%eax
  lea    0xa(%rax),%ecx
  movslq %ecx,%rcx
  movzbl (%rsp,%rcx,1),%ecx
  mov    %cl,0x1(%rdi)
  mov    %eax,%ecx
  shl    $0x4,%ecx
  sub    %ecx,%eax
  shl    $0x4,%eax
  add    %edx,%eax
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x2aaaaaab,%rdx,%rdx
  sar    $0x22,%rdx
  sub    %eax,%edx
  movslq %edx,%rax
  movzbl (%rsp,%rax,1),%eax
  mov    %al,0x3(%rdi)
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  add    $0x38,%rsp
  ret
  nopw   0x0(%rax,%rax,1)
L9:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  lea    D67(%rip),%rsi
  add    $0x38,%rsp
  jmp    1060 <strcpy@plt>
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D29
type: byte[16]
name: extract_symbolic_data
arguments: data_label: D25
type: byte[16]
name: extract_symbolic_data
arguments: data_label: D60
type: f64
name: extract_symbolic_data
arguments: data_label: D20
type: f64
name: extract_symbolic_data
arguments: data_label: D64
type: f64
name: extract_symbolic_data
arguments: data_label: D1
type: f64
name: extract_symbolic_data
arguments: data_label: D67
type: string

tool: {"D29": [0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46]}

tool: {"D25": [0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56]}

tool: D60: 180

tool: D20: 60

tool: D64: 5

tool: D1: 2.5

tool: D67: XXXX

assistant: ```c
void unpackgrid(int ngrid, char *grid) {
  char c[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' '};
  int dlat, dlong;
  ngrid = ngrid >> 7;
  if (ngrid < 32400) {
    dlat = (ngrid % 180) - 90;
    dlong = (ngrid / 180) * 2 - 180 + 2;
    if (dlong < -180)
      dlong = dlong + 360;
    if (dlong > 180)
      dlong = dlong + 360;
    int nlong = 60.0 * (180.0 - dlong) / 5.0;
    int n1 = nlong / 240;
    int n2 = (nlong - 240 * n1) / 24;
    grid[0] = c[10 + n1];
    grid[2] = c[n2];
    int nlat = 60.0 * (dlat + 90) / 2.5;
    n1 = nlat / 240;
    n2 = (nlat - 240 * n1) / 24;
    grid[1] = c[10 + n1];
    grid[3] = c[n2];
  } else {
    strcpy(grid, "XXXX");
  }
}
```