user: 请将以下的汇编代码转换成C语言代码:

```asm
<field2regular>:
  endbr64
  push   %r15
  push   %r14
  lea    D20(%rip),%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x68,%rsp
  mov    %esi,0x8(%rsp)
  mov    %rdx,0x18(%rsp)
  movsd  %xmm0,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  call   <gridInqType@plt>
  cmp    $0x3,%eax
  je     L40
  lea    D36(%rip),%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <Error_@plt>
L40:
  xor    %eax,%eax
  test   %ebx,%ebx
  lea    D29(%rip),%r15
  mov    %ebp,%edi
  setg   %al
  mov    %eax,0xc(%rsp)
  xor    %eax,%eax
  call   <gridInqYsize@plt>
  mov    %ebp,%edi
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <gridInqNP@plt>
  movslq %ebx,%rcx
  mov    $0x331,%edx
  mov    %r15,%rsi
  shl    $0x2,%rcx
  mov    %r14,%rdi
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <Malloc@plt>
  mov    %ebp,%edi
  movslq %eax,%r12
  xor    %eax,%eax
  mov    %r12,%rsi
  call   <gridInqRowlon@plt>
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  lea    0x40(%rsp),%rsi
  mov    %ebp,%edi
  movaps %xmm0,0x40(%rsp)
  call   <gridInqXvals@plt>
  movsd  0x40(%rsp),%xmm0
  movq   D10(%rip),%xmm2
  movsd  0x48(%rsp),%xmm1
  movapd %xmm0,%xmm3
  andpd  %xmm2,%xmm3
  comisd D39(%rip),%xmm3
  ja     L18
  test   %r13d,%r13d
  jle    L20
  pxor   %xmm4,%xmm4
  movsd  D30(%rip),%xmm3
  movsd  D14(%rip),%xmm5
  cvtsi2sd %r13d,%xmm4
  divsd  %xmm4,%xmm3
  movapd %xmm1,%xmm4
  subsd  %xmm3,%xmm5
  subsd  %xmm5,%xmm4
  andpd  %xmm4,%xmm2
  comisd %xmm3,%xmm2
  ja     L18
L20:
  push   $0x0
  lea    (%rbx,%rbx,1),%ebp
  mov    %ebx,%edx
  mov    %r12,%rsi
  push   $0x1
  mov    0x1c(%rsp),%r9d
  mov    %ebp,%ecx
  mov    $0x1,%eax
  movsd  0x20(%rsp),%xmm0
  mov    0x28(%rsp),%rdi
  lea    0x4c(%rsp),%r8
  call   <qu2reg3_double@plt>
  pop    %rax
  pop    %rdx
  jmp    L49
  xchg   %ax,%ax
L18:
  mov    %ebp,%edi
  xor    %eax,%eax
  movsd  %xmm1,0x28(%rsp)
  movsd  %xmm0,0x20(%rsp)
  call   <gridInqSize@plt>
  sub    $0x8,%rsp
  mov    %ebx,%r8d
  mov    %r12,%rcx
  push   $0x0
  mov    %eax,%edi
  mov    %r13d,%esi
  push   $0x1
  mov    0x24(%rsp),%eax
  push   %rax
  movsd  0x30(%rsp),%xmm2
  mov    $0x3,%eax
  mov    0x38(%rsp),%rdx
  movsd  0x48(%rsp),%xmm1
  movsd  0x40(%rsp),%xmm0
  lea    0x5c(%rsp),%r9
  call   <qu2reg_subarea@plt>
  add    $0x20,%rsp
  mov    %eax,%ebp
L49:
  mov    0x8(%rsp),%edi
  imul   %ebx,%ebp
  xor    %eax,%eax
  call   <gridInqSize@plt>
  cmp    %ebp,%eax
  je     L4
  lea    D37(%rip),%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <Error_@plt>
L4:
  xor    %eax,%eax
  mov    %r12,%rcx
  mov    $0x346,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <Free@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D20
datatype: string
name: parse_data
arguments: tag: D36
datatype: string
name: parse_data
arguments: tag: D29
datatype: string
name: parse_data
arguments: tag: D10
datatype: qword
name: parse_data
arguments: tag: D39
datatype: f64[2]
name: parse_data
arguments: tag: D30
datatype: f64
name: parse_data
arguments: tag: D14
datatype: f64
name: parse_data
arguments: tag: D37
datatype: string

tool: D20: field2regular

tool: D36: Not a reduced gaussian grid!

tool: D29: /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: D10: 9223372036854775807

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

tool: D30: 90

tool: D14: 360

tool: D37: 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));
}
```