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

```asm
<tpnhalo>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %rdi,%r12
  mov    %esi,%edi
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x18,%rsp
  call   <gridInqXsize@plt>
  mov    %r13d,%edi
  mov    %eax,%ebp
  call   <gridInqYsize@plt>
  mov    %eax,0x4(%rsp)
  test   %eax,%eax
  jle    L156
  test   %ebp,%ebp
  jle    L33
  movslq %ebp,%rax
  lea    0x0(%rbp,%rbp,1),%r15d
  lea    -0x1(%rbp),%edx
  mov    %ebp,%ecx
  mov    %rax,0x8(%rsp)
  mov    %r12,%rsi
  and    $0xfffffffe,%ecx
  xor    %r11d,%r11d
  lea    0x0(,%rax,8),%r13
  movslq %r15d,%rax
  mov    %edx,(%rsp)
  mov    %ebp,%r10d
  lea    (%rbx,%rax,8),%rdi
  mov    %ebp,%eax
  shr    %eax
  lea    -0x1(%rax),%r9d
  xor    %eax,%eax
  add    $0x1,%r9
  shl    $0x4,%r9
  nopw   0x0(%rax,%rax,1)
L158:
  cmpl   $0x2,(%rsp)
  lea    (%rax,%r15,1),%r8d
  jbe    L63
  lea    0x8(%rsi),%r14
  xor    %edx,%edx
  cmp    %r14,%rdi
  je     L63
  nopl   (%rax)
L41:
  movupd (%rsi,%rdx,1),%xmm1
  movups %xmm1,(%rdi,%rdx,1)
  add    $0x10,%rdx
  cmp    %rdx,%r9
  jne    L41
  cmp    %ecx,%ebp
  je     L135
  add    %ecx,%eax
  cltq
  movsd  (%r12,%rax,8),%xmm0
  lea    (%r8,%rcx,1),%eax
  cltq
  movsd  %xmm0,(%rbx,%rax,8)
L135:
  mov    %r8d,%eax
  add    $0x1,%r11d
  add    %r13,%rdi
  add    %r13,%rsi
  sub    %ebp,%eax
  cmp    %r11d,0x4(%rsp)
  jne    L158
L113:
  mov    0x8(%rsp),%rcx
  lea    0x0(%rbp,%rbp,1),%esi
  lea    (%rsi,%rbp,1),%edi
  lea    (%r10,%rcx,1),%r9
  lea    (%rcx,%rcx,2),%r8
  neg    %r10
  lea    0x0(,%r10,8),%rax
  shl    $0x3,%r8
  lea    0x0(,%rcx,8),%rdx
  shl    $0x3,%r9
  shl    $0x5,%rcx
  lea    (%rax,%r8,1),%r11
  lea    (%rcx,%rax,1),%r12
  neg    %rax
  cmp    %r9,%r11
  mov    %rcx,%r10
  setge  %cl
  cmp    %r8,%rdx
  setge  %r13b
  or     %r13d,%ecx
  cmpl   $0x1,(%rsp)
  seta   %r13b
  and    %r13d,%ecx
  cmp    %rdx,%r10
  setle  %r13b
  cmp    %r9,%r12
  setge  %r9b
  or     %r13d,%r9d
  and    %r9d,%ecx
  cmp    %rax,%r11
  setge  %r9b
  test   %r9b,%cl
  je     L18
  cmp    %rax,%r12
  jl     L18
  mov    %ebp,%ecx
  lea    -0x10(%rbx,%r8,1),%r9
  lea    -0x10(%rbx,%r10,1),%rdi
  xor    %eax,%eax
  shr    %ecx
  lea    (%rbx,%rdx,1),%r8
  xor    %edx,%edx
  neg    %rcx
  shl    $0x4,%rcx
  nop
L97:
  movupd (%r9,%rax,1),%xmm0
  shufpd $0x1,%xmm0,%xmm0
  movups %xmm0,(%r8,%rdx,1)
  movupd (%rdi,%rax,1),%xmm0
  sub    $0x10,%rax
  shufpd $0x1,%xmm0,%xmm0
  movups %xmm0,(%rbx,%rdx,1)
  add    $0x10,%rdx
  cmp    %rcx,%rax
  jne    L97
  mov    %ebp,%eax
  and    $0xfffffffe,%eax
  test   $0x1,%bpl
  je     L33
  mov    %ebp,%edx
  sub    %eax,%edx
  lea    -0x1(%rsi,%rdx,1),%ecx
  movslq %ecx,%rdx
  movsd  (%rbx,%rdx,8),%xmm0
  lea    0x0(%rbp,%rax,1),%edx
  add    %ecx,%ebp
  movslq %edx,%rdx
  movslq %ebp,%rbp
  movsd  %xmm0,(%rbx,%rdx,8)
  movsd  (%rbx,%rbp,8),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
L33:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L63:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L143:
  movsd  (%rsi,%rax,8),%xmm0
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %r10,%rax
  jne    L143
  jmp    L135
L18:
  mov    0x8(%rsp),%r14
  movslq %esi,%rsi
  movslq %edi,%rdi
  lea    (%rbx,%rdx,1),%rcx
  sub    %rsi,%rdi
  neg    %rdx
  lea    -0x1(%rsi,%r14,1),%rax
  lea    (%rbx,%rax,8),%r8
  mov    (%rsp),%eax
  add    %r14,%rax
  lea    0x8(%rbx,%rax,8),%rax
  nopl   0x0(%rax)
L137:
  movsd  (%r8),%xmm0
  add    $0x8,%rcx
  movsd  %xmm0,-0x8(%rcx)
  movsd  (%r8,%rdi,8),%xmm0
  sub    $0x8,%r8
  movsd  %xmm0,-0x8(%rcx,%rdx,1)
  cmp    %rax,%rcx
  jne    L137
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L156:
  test   %ebp,%ebp
  jle    L33
  movslq %ebp,%rax
  mov    %ebp,%r10d
  mov    %rax,0x8(%rsp)
  lea    -0x1(%rbp),%eax
  mov    %eax,(%rsp)
  jmp    L113
```

assistant: ```c
void tpnhalo(double *array1, int gridID1, double *array2) {
  int nlon, nlat;
  int ilat, ilon, ilonr;
  nlon = gridInqXsize(gridID1);
  nlat = gridInqYsize(gridID1);
  for (ilat = 0; ilat < nlat; ilat++) {
    for (ilon = 0; ilon < nlon; ilon++)
      array2[(ilat + 2) * nlon + ilon] = array1[ilat * nlon + ilon];
  }
  for (ilon = 0; ilon < nlon; ilon++) {
    ilonr = nlon - ilon - 1;
    array2[1 * nlon + ilon] = array2[2 * nlon + ilonr];
    array2[0 * nlon + ilon] = array2[3 * nlon + ilonr];
  }
}
```