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

```asm
<read_geogrid>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x4c0,%rsp
  mov    %rdi,-0x468(%rbp)
  mov    %rsi,-0x470(%rbp)
  mov    %rdx,-0x478(%rbp)
  mov    %rcx,-0x480(%rbp)
  mov    %r8,-0x488(%rbp)
  mov    %r9,-0x490(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x498(%rbp)
  mov    0x18(%rbp),%rax
  mov    %rax,-0x4a0(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rax,-0x4a8(%rbp)
  mov    0x28(%rbp),%rax
  mov    %rax,-0x4b0(%rbp)
  mov    0x30(%rbp),%rax
  mov    %rax,-0x4b8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x4b8(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x480(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x488(%rbp),%rax
  mov    (%rax),%eax
  imul   %eax,%edx
  mov    -0x490(%rbp),%rax
  mov    (%rax),%eax
  imul   %edx,%eax
  mov    %eax,-0x428(%rbp)
  mov    -0x470(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x468(%rbp),%rcx
  lea    -0x410(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x470(%rbp),%rax
  mov    (%rax),%eax
  cltq
  movb   $0x0,-0x410(%rbp,%rax,1)
  lea    -0x410(%rbp),%rax
  lea    D9(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x420(%rbp)
  cmpq   $0x0,-0x420(%rbp)
  jne    L154
  mov    -0x4b8(%rbp),%rax
  movl   $0x1,(%rax)
  mov    $0x1,%eax
  jmp    L167
L154:
  mov    -0x4b0(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  mov    -0x428(%rbp),%eax
  imul   %edx,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x418(%rbp)
  mov    -0x4b0(%rbp),%rax
  mov    (%rax),%eax
  imul   -0x428(%rbp),%eax
  mov    %eax,%edx
  mov    -0x420(%rbp),%rcx
  mov    -0x418(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  mov    %eax,-0x424(%rbp)
  mov    -0x420(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  cmpl   $0x0,-0x424(%rbp)
  jne    L66
  mov    -0x4b8(%rbp),%rax
  movl   $0x1,(%rax)
  mov    $0x1,%eax
  jmp    L167
L66:
  mov    -0x4a0(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L198
  movl   $0x0,-0x44c(%rbp)
  movl   $0x1,-0x448(%rbp)
  movl   $0x0,-0x444(%rbp)
  movl   $0x1,-0x440(%rbp)
  movl   $0x2,-0x43c(%rbp)
  movl   $0x0,-0x438(%rbp)
  movl   $0x1,-0x434(%rbp)
  movl   $0x2,-0x430(%rbp)
  movl   $0x3,-0x42c(%rbp)
  jmp    L170
L198:
  movl   $0x0,-0x448(%rbp)
  movl   $0x1,-0x44c(%rbp)
  movl   $0x0,-0x43c(%rbp)
  movl   $0x1,-0x440(%rbp)
  movl   $0x2,-0x444(%rbp)
  movl   $0x0,-0x42c(%rbp)
  movl   $0x1,-0x430(%rbp)
  movl   $0x2,-0x434(%rbp)
  movl   $0x3,-0x438(%rbp)
L170:
  mov    -0x4b0(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x4,%eax
  je     L201
  cmp    $0x4,%eax
  jg     L285
  cmp    $0x3,%eax
  je     L274
  cmp    $0x3,%eax
  jg     L285
  cmp    $0x1,%eax
  je     L186
  cmp    $0x2,%eax
  je     L80
  jmp    L285
L186:
  movl   $0x0,-0x454(%rbp)
  jmp    L256
L306:
  mov    -0x454(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x450(%rbp)
  mov    -0x498(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L168
  cmpl   $0x80,-0x450(%rbp)
  jle    L168
  subl   $0x100,-0x450(%rbp)
L168:
  mov    -0x454(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x478(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x450(%rbp),%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x454(%rbp)
L256:
  mov    -0x454(%rbp),%eax
  cmp    -0x428(%rbp),%eax
  jl     L306
  jmp    L285
L80:
  movl   $0x0,-0x454(%rbp)
  jmp    L264
L309:
  mov    -0x454(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x44c(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  mov    %eax,%ecx
  mov    -0x454(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x448(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %ecx,%eax
  mov    %eax,-0x450(%rbp)
  mov    -0x498(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L250
  cmpl   $0x8000,-0x450(%rbp)
  jle    L250
  subl   $0x10000,-0x450(%rbp)
L250:
  mov    -0x454(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x478(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x450(%rbp),%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x454(%rbp)
L264:
  mov    -0x454(%rbp),%eax
  cmp    -0x428(%rbp),%eax
  jl     L309
  jmp    L285
L274:
  movl   $0x0,-0x454(%rbp)
  jmp    L26
L222:
  mov    -0x454(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %eax,%edx
  mov    -0x444(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x10,%eax
  mov    %eax,%ecx
  mov    -0x454(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %eax,%edx
  mov    -0x440(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  or     %eax,%ecx
  mov    -0x454(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %eax,%edx
  mov    -0x43c(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %ecx,%eax
  mov    %eax,-0x450(%rbp)
  mov    -0x498(%rbp),%rax
  mov    (%rax),%edx
  cmpl   $0x800000,-0x450(%rbp)
  setg   %al
  movzbl %al,%eax
  imul   %edx,%eax
  test   %eax,%eax
  je     L308
  subl   $0x1000000,-0x450(%rbp)
L308:
  mov    -0x454(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x478(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x450(%rbp),%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x454(%rbp)
L26:
  mov    -0x454(%rbp),%eax
  cmp    -0x428(%rbp),%eax
  jl     L222
  jmp    L285
L201:
  movl   $0x0,-0x454(%rbp)
  jmp    L24
L117:
  mov    -0x454(%rbp),%eax
  lea    0x0(,%rax,4),%edx
  mov    -0x438(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x18,%eax
  mov    %eax,%ecx
  mov    -0x454(%rbp),%eax
  lea    0x0(,%rax,4),%edx
  mov    -0x434(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x10,%eax
  or     %eax,%ecx
  mov    -0x454(%rbp),%eax
  lea    0x0(,%rax,4),%edx
  mov    -0x430(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  or     %eax,%ecx
  mov    -0x454(%rbp),%eax
  lea    0x0(,%rax,4),%edx
  mov    -0x42c(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x418(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  or     %ecx,%eax
  mov    %eax,-0x450(%rbp)
  mov    -0x498(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L28
  cmpl   $0x80000000,-0x450(%rbp)
L28:
  mov    -0x454(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x478(%rbp),%rax
  add    %rdx,%rax
  pxor   %xmm0,%xmm0
  cvtsi2ssl -0x450(%rbp),%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x454(%rbp)
L24:
  mov    -0x454(%rbp),%eax
  cmp    -0x428(%rbp),%eax
  jl     L117
  nop
L285:
  mov    -0x418(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x4a8(%rbp),%rax
  movss  (%rax),%xmm0
  movss  D2(%rip),%xmm1
  ucomiss %xmm1,%xmm0
  jp     L213
  movss  D2(%rip),%xmm1
  ucomiss %xmm1,%xmm0
  je     L205
L213:
  movl   $0x0,-0x454(%rbp)
  jmp    L312
L84:
  mov    -0x454(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x478(%rbp),%rax
  add    %rdx,%rax
  movss  (%rax),%xmm1
  mov    -0x4a8(%rbp),%rax
  movss  (%rax),%xmm0
  mov    -0x454(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x478(%rbp),%rax
  add    %rdx,%rax
  mulss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  addl   $0x1,-0x454(%rbp)
L312:
  mov    -0x454(%rbp),%eax
  cmp    -0x428(%rbp),%eax
  jl     L84
L205:
  mov    $0x0,%eax
L167:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L89
  call   <__stack_chk_fail@plt>
L89:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D9
type: string
name: extract_symbolic_data
arguments: tag: D2
type: f32

tool: D9: rb

tool: D2: 1

assistant: ```c
int read_geogrid(char *fname, int *len, float *rarray, int *nx, int *ny, int *nz, int *isigned, int *endian, float *scalefactor, int *wordsize, int *status) {
  int i, ival, cnt, narray;
  int A2, B2;
  int A3, B3, C3;
  int A4, B4, C4, D4;
  unsigned char *c;
  char local_fname[1024];
  FILE *bfile;
  *status = 0;
  narray = (*nx) * (*ny) * (*nz);
  strncpy(local_fname, fname, *len);
  local_fname[*len] = '\0';
  if (!(bfile = fopen(local_fname, "rb"))) {
    *status = 1;
    return 1;
  }
  c = (unsigned char *)malloc(sizeof(unsigned char) * (*wordsize) * narray);
  cnt = fread((void *)c, sizeof(unsigned char), narray * (*wordsize), bfile);
  fclose(bfile);
  if (cnt == 0) {
    *status = 1;
    return 1;
  }
  if (*endian == 0) {
    A2 = 0;
    B2 = 1;
    A3 = 0;
    B3 = 1;
    C3 = 2;
    A4 = 0;
    B4 = 1;
    C4 = 2;
    D4 = 3;
  } else {
    B2 = 0;
    A2 = 1;
    C3 = 0;
    B3 = 1;
    A3 = 2;
    D4 = 0;
    C4 = 1;
    B4 = 2;
    A4 = 3;
  }
  switch (*wordsize) {
  case 1:
    for (i = 0; i < narray; i++) {
      ival = (int)(c[i]);
      if ((*isigned) && (ival > (1 << 7)))
        ival -= (1 << 8);
      rarray[i] = (float)ival;
    }
    break;
  case 2:
    for (i = 0; i < narray; i++) {
      ival = (int)((c[2 * i + A2] << 8) | (c[2 * i + B2]));
      if ((*isigned) && (ival > (1 << 15)))
        ival -= (1 << 16);
      rarray[i] = (float)ival;
    }
    break;
  case 3:
    for (i = 0; i < narray; i++) {
      ival = (int)((c[3 * i + A3] << 16) | (c[3 * i + B3] << 8) | c[3 * i + C3]);
      if ((*isigned) * (ival > (1 << 23)))
        ival -= (1 << 24);
      rarray[i] = (float)ival;
    }
    break;
  case 4:
    for (i = 0; i < narray; i++) {
      ival = (int)((c[4 * i + A4] << 24) | (c[4 * i + B4] << 16) | (c[4 * i + C4] << 8) | c[4 * i + D4]);
      if ((*isigned) && (ival > (1 << 31)))
        ival -= (1 << 32);
      rarray[i] = (float)ival;
    }
    break;
  }
  free(c);
  if (*scalefactor != 1.0) {
    for (i = 0; i < narray; i++)
      rarray[i] = rarray[i] * (*scalefactor);
  }
  return 0;
}
```