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

```asm
<field2regular>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,%ebx
  mov    %esi,%r13d
  movsd  %xmm0,(%rsp)
  mov    %rdx,0x8(%rsp)
  mov    %ecx,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <gridInqType@plt>
  cmp    $0x3,%eax
  jne    L32
L4:
  test   %ebp,%ebp
  setg   %r15b
  movzbl %r15b,%r15d
  mov    %ebx,%edi
  mov    $0x0,%eax
  call   <gridInqYsize@plt>
  mov    %eax,%ebp
  mov    %ebx,%edi
  mov    $0x0,%eax
  call   <gridInqNP@plt>
  mov    %eax,%r14d
  movslq %ebp,%rcx
  shl    $0x2,%rcx
  mov    $0x331,%edx
  lea    D11(%rip),%rsi
  lea    D51(%rip),%rdi
  mov    $0x0,%eax
  call   <Malloc@plt>
  movslq %eax,%r12
  mov    %r12,%rsi
  mov    %ebx,%edi
  mov    $0x0,%eax
  call   <gridInqRowlon@plt>
  movq   $0x0,0x30(%rsp)
  movq   $0x0,0x38(%rsp)
  lea    0x30(%rsp),%rsi
  mov    %ebx,%edi
  mov    $0x0,%eax
  call   <gridInqXvals@plt>
  movsd  0x30(%rsp),%xmm3
  movsd  %xmm3,0x10(%rsp)
  movsd  0x38(%rsp),%xmm4
  movsd  %xmm4,0x18(%rsp)
  andpd  D124(%rip),%xmm3
  comisd D25(%rip),%xmm3
  ja     L12
  test   %r14d,%r14d
  jle    L40
  pxor   %xmm1,%xmm1
  cvtsi2sd %r14d,%xmm1
  movsd  D77(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  D101(%rip),%xmm2
  subsd  %xmm0,%xmm2
  movapd %xmm4,%xmm1
  subsd  %xmm2,%xmm1
  andpd  D124(%rip),%xmm1
  comisd %xmm0,%xmm1
  jbe    L40
L12:
  mov    %ebx,%edi
  mov    $0x0,%eax
  call   <gridInqSize@plt>
  mov    %eax,%edi
  sub    $0x8,%rsp
  push   $0x0
  push   $0x1
  push   %r15
  lea    0x4c(%rsp),%r9
  movsd  0x20(%rsp),%xmm2
  mov    %ebp,%r8d
  mov    %r12,%rcx
  mov    0x28(%rsp),%rdx
  movsd  0x38(%rsp),%xmm1
  movsd  0x30(%rsp),%xmm0
  mov    %r14d,%esi
  mov    $0x3,%eax
  call   <qu2reg_subarea@plt>
  mov    %eax,%ebx
  add    $0x20,%rsp
L43:
  mov    %r13d,%edi
  mov    $0x0,%eax
  call   <gridInqSize@plt>
  imul   %ebp,%ebx
  cmp    %ebx,%eax
  jne    L35
L51:
  mov    %r12,%rcx
  mov    $0x346,%edx
  lea    D11(%rip),%rsi
  lea    D51(%rip),%rdi
  mov    $0x0,%eax
  call   <Free@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L32:
  lea    D9(%rip),%rsi
  lea    D51(%rip),%rdi
  mov    $0x0,%eax
  call   <Error_@plt>
  jmp    L4
L40:
  lea    0x0(%rbp,%rbp,1),%ebx
  push   $0x0
  push   $0x1
  mov    %r15d,%r9d
  lea    0x3c(%rsp),%r8
  movsd  0x10(%rsp),%xmm0
  mov    %ebx,%ecx
  mov    %ebp,%edx
  mov    %r12,%rsi
  mov    0x18(%rsp),%rdi
  mov    $0x1,%eax
  call   <qu2reg3_double@plt>
  add    $0x10,%rsp
  jmp    L43
L35:
  lea    D75(%rip),%rsi
  lea    D51(%rip),%rdi
  mov    $0x0,%eax
  call   <Error_@plt>
  jmp    L51
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D11
type_guessed: string
name: read_data
arguments: tag: D51
type_guessed: string
name: read_data
arguments: tag: D124
type_guessed: qword[2]
name: read_data
arguments: tag: D25
type_guessed: f64[2]
name: read_data
arguments: tag: D77
type_guessed: f64
name: read_data
arguments: tag: D101
type_guessed: f64
name: read_data
arguments: tag: D9
type_guessed: string
name: read_data
arguments: tag: D75
type_guessed: string

tool: D11: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/grid.c

tool: D51: field2regular

tool: {"D124": [0x7fffffffffffffff,0x0000000000000000]}

tool: {"D25": [0.0,90.0]}

tool: D77: 90

tool: D101: 360

tool: D9: Not a reduced gaussian grid!

tool: D75: Gridsize differ!

assistant: ```c
void field2regular(int gridID1, int gridID2, double missval, double *array, int nmiss) {
  int nx = 0, ny, np;
  int gridtype;
  int lmiss, lperio, lveggy;
  int iret;
  int *rowlon;
  double xfirstandlast[2];
  double xfirst, xlast;
  gridtype = gridInqType(gridID1);
  if (gridtype != 3)
    Error_(__func__, "Not a reduced gaussian grid!");
  lmiss = nmiss > 0;
  lperio = 1;
  lveggy = 0;
  ny = gridInqYsize(gridID1);
  np = gridInqNP(gridID1);
  rowlon = (int *)Malloc(__func__, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/grid.c", 817, (ny * sizeof(int)));
  gridInqRowlon(gridID1, rowlon);
  xfirstandlast[0] = 0.;
  xfirstandlast[1] = 0.;
  gridInqXvals(gridID1, xfirstandlast);
  xfirst = xfirstandlast[0];
  xlast = xfirstandlast[1];
  if (fabs(xfirst) > 0 || (np > 0 && fabs(xlast - (360.0 - 90.0 / np)) > 90.0 / np)) {
    nx = qu2reg_subarea(gridInqSize(gridID1), np, xfirst, xlast, array, rowlon, ny, missval, &iret, lmiss, lperio, lveggy);
  } else {
    nx = 2 * ny;
    (void)qu2reg3_double(array, rowlon, ny, nx, missval, &iret, lmiss, lperio, lveggy);
  }
  if (gridInqSize(gridID2) != nx * ny)
    Error_(__func__, "Gridsize differ!");
  Free(__func__, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/grid.c", 838, (rowlon));
}
```