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

```asm
<check2dsurface>:
  endbr64
  push   %r15
  mov    %rcx,%r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  mov    %r8d,%ebx
  sub    $0x18,%rsp
  mov    (%rdx),%eax
  mov    (%rdi),%r14d
  mov    %rdi,(%rsp)
  lea    (%rax,%rax,2),%edx
  mov    %r9d,0x8(%rsp)
  test   %edx,%edx
  jle    L248
  lea    -0x1(%rdx),%eax
  cmp    $0x2,%eax
  jbe    L151
  mov    %rcx,%rax
  mov    %edx,%ecx
  movd   %r8d,%xmm2
  shr    $0x2,%ecx
  pshufd $0x0,%xmm2,%xmm1
  sub    $0x1,%ecx
  shl    $0x4,%rcx
  lea    0x10(%r15,%rcx,1),%rcx
  nopl   (%rax)
L19:
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  psubd  %xmm1,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rcx,%rax
  jne    L19
  mov    %edx,%ecx
  and    $0xfffffffc,%ecx
  test   $0x3,%dl
  je     L248
L45:
  movslq %ecx,%rax
  lea    0x1(%rcx),%esi
  shl    $0x2,%rax
  sub    %ebx,(%r15,%rax,1)
  cmp    %esi,%edx
  jle    L248
  add    $0x2,%ecx
  sub    %ebx,0x4(%r15,%rax,1)
  cmp    %ecx,%edx
  jle    L248
  sub    %ebx,0x8(%r15,%rax,1)
L248:
  lea    0x0(,%r14,4),%edi
  call   <libaft_malloc@plt>
  mov    %r13,%rsi
  mov    %r14d,%edi
  mov    %rax,%rdx
  mov    %rax,%rbp
  call   <check_xyz@plt>
  test   %rax,%rax
  jne    L108
  mov    0x50(%rsp),%edi
  test   %edi,%edi
  jne    L216
  mov    (%r12),%r14d
  xor    %ecx,%ecx
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14d,%edi
  call   <check_tri@plt>
  xor    %r8d,%r8d
  test   %rax,%rax
  je     L205
L356:
  mov    0x8(%rsp),%edx
  mov    $0x1,%r8d
  test   %edx,%edx
  je     L205
  movl   $0x0,0xc(%rsp)
L332:
  mov    (%rsp),%rdi
  mov    %r15,%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %r8d,0x8(%rsp)
  call   <fix_tri@plt>
  mov    0x8(%rsp),%r8d
  test   %rax,%rax
  jne    L205
  mov    0x50(%rsp),%eax
  mov    0xc(%rsp),%r8d
  test   %eax,%eax
  je     L205
L239:
  lea    D29(%rip),%rdi
  call   <libaft_3d_warn@plt>
  mov    0xc(%rsp),%r8d
  jmp    L205
  nopl   0x0(%rax,%rax,1)
L108:
  mov    0x8(%rsp),%esi
  test   %esi,%esi
  jne    L355
  mov    (%r12),%r14d
  mov    0x50(%rsp),%ecx
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14d,%edi
  call   <check_tri@plt>
  test   %rax,%rax
  je     L335
  mov    $0x2,%r8d
L205:
  mov    %rbp,%rdi
  mov    %r8d,0x8(%rsp)
  call   <libaft_free@plt>
  lea    (%r14,%r14,2),%edx
  mov    0x8(%rsp),%r8d
  test   %edx,%edx
  jle    L2
  lea    -0x1(%rdx),%eax
  cmp    $0x2,%eax
  jbe    L282
  mov    %edx,%ecx
  movd   %ebx,%xmm3
  mov    %r15,%rax
  shr    $0x2,%ecx
  pshufd $0x0,%xmm3,%xmm1
  sub    $0x1,%ecx
  shl    $0x4,%rcx
  lea    0x10(%r15,%rcx,1),%rcx
  nopl   0x0(%rax,%rax,1)
L182:
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  paddd  %xmm1,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rcx,%rax
  jne    L182
  mov    %edx,%ecx
  and    $0xfffffffc,%ecx
  test   $0x3,%dl
  je     L2
L122:
  movslq %ecx,%rax
  lea    0x1(%rcx),%esi
  shl    $0x2,%rax
  add    %ebx,(%r15,%rax,1)
  cmp    %edx,%esi
  jge    L2
  add    $0x2,%ecx
  add    %ebx,0x4(%r15,%rax,1)
  cmp    %edx,%ecx
  jge    L2
  add    %ebx,0x8(%r15,%rax,1)
L2:
  add    $0x18,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L355:
  mov    (%rsp),%rdi
  mov    %rbp,%r8
  mov    %r15,%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  call   <fix_xyz@plt>
  test   %rax,%rax
  jne    L119
  mov    0x50(%rsp),%ecx
  test   %ecx,%ecx
  jne    L188
  mov    (%r12),%r14d
  xor    %ecx,%ecx
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14d,%edi
  call   <check_tri@plt>
  xor    %r8d,%r8d
  test   %rax,%rax
  je     L205
  mov    (%rsp),%rdi
  mov    %r15,%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  call   <fix_tri@plt>
  xor    %r8d,%r8d
  test   %rax,%rax
  setne  %r8b
  jmp    L205
  nopw   0x0(%rax,%rax,1)
L216:
  lea    D26(%rip),%rdi
  call   <libaft_3d_warn@plt>
  mov    (%r12),%r14d
  mov    0x50(%rsp),%ecx
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14d,%edi
  call   <check_tri@plt>
  xor    %r8d,%r8d
  test   %rax,%rax
  jne    L356
L240:
  lea    D20(%rip),%rdi
  mov    %r8d,0x8(%rsp)
  call   <libaft_3d_warn@plt>
  mov    0x8(%rsp),%r8d
  jmp    L205
L282:
  xor    %ecx,%ecx
  jmp    L122
L151:
  xor    %ecx,%ecx
  jmp    L45
L119:
  mov    (%r12),%r14d
  mov    0x50(%rsp),%ecx
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14d,%edi
  call   <check_tri@plt>
  test   %rax,%rax
  je     L335
  movl   $0x1,0xc(%rsp)
  mov    $0x2,%r8d
  jmp    L332
L188:
  lea    D30(%rip),%rdi
  call   <libaft_3d_warn@plt>
  mov    (%r12),%r14d
  mov    0x50(%rsp),%ecx
  mov    %ebx,%edx
  mov    %r15,%rsi
  mov    %r14d,%edi
  call   <check_tri@plt>
  xor    %r8d,%r8d
  test   %rax,%rax
  je     L240
  mov    (%rsp),%rdi
  mov    %r15,%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  call   <fix_tri@plt>
  movl   $0x0,0xc(%rsp)
  mov    $0x1,%r8d
  test   %rax,%rax
  je     L239
  jmp    L205
L335:
  cmpl   $0x0,0x50(%rsp)
  mov    $0x1,%r8d
  jne    L240
  jmp    L205
```

tool_calls: name: read_data
arguments: data_tag: D29
type_infered: string
name: read_data
arguments: data_tag: D26
type_infered: string
name: read_data
arguments: data_tag: D20
type_infered: string
name: read_data
arguments: data_tag: D30
type_infered: string

tool: D29: Check: updated surface topology


tool: D26: Check: xyz coords - OK


tool: D20: Check: surface topology - OK


tool: D30: Check: updated xyz coords and topology


assistant: ```c
int check2dsurface(int *pnV, double *vertex, int *pnF, int *face, int indshift, int autofix, int verbose) {
  int nV = *pnV, nF = *pnF, i;
  int *index;
  int result;
  for (i = 0; i < 3 * nF; face[i++] -= indshift)
    ;
  index = (int *)libaft_malloc(sizeof(int) * nV);
  result = 0;
  if (check_xyz(nV, vertex, index) == 0) {
    if (verbose)
      libaft_3d_warn("Check: xyz coords - OK\n");
  } else if ((autofix) && (fix_xyz(pnV, vertex, pnF, face, index) == 0)) {
    if (verbose)
      libaft_3d_warn("Check: updated xyz coords and topology\n");
  } else {
    result++;
  }
  nV = *pnV;
  nF = *pnF;
  if (check_tri(nF, face, indshift, verbose) == 0) {
    if (verbose)
      libaft_3d_warn("Check: surface topology - OK\n");
  } else if ((autofix) && (fix_tri(pnV, vertex, pnF, face) == 0)) {
    if (verbose)
      libaft_3d_warn("Check: updated surface topology\n");
  } else {
    result++;
  }
  libaft_free(index);
  for (i = 0; i < 3 * nF; face[i++] += indshift)
    ;
  return result;
}
```