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

```asm
<check_tri>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,%r13d
  mov    %rsi,%r14
  mov    %edx,0x2c(%rsp)
  mov    %ecx,0x14(%rsp)
  test   %ecx,%ecx
  jne    L339
  test   %edi,%edi
  jle    L219
L240:
  mov    %r14,%rcx
  mov    $0x0,%ebp
  mov    $0x0,%esi
  jmp    L302
L339:
  lea    D26(%rip),%rdi
  call   <puts@plt>
  test   %r13d,%r13d
  jg     L240
  mov    $0x0,%ebp
L191:
  mov    0x2c(%rsp),%eax
  lea    0x0(%rbp,%rax,1),%esi
  lea    D28(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L312
L85:
  add    $0x1,%esi
  add    $0xc,%rcx
  cmp    %esi,%r13d
  jle    L306
L302:
  mov    $0x0,%eax
L300:
  mov    (%rcx,%rax,4),%edx
  cmp    %edx,%ebp
  cmovl  %edx,%ebp
  add    $0x1,%rax
  cmp    $0x3,%rax
  jne    L300
  jmp    L85
L306:
  cmpl   $0x0,0x14(%rsp)
  jne    L191
L312:
  lea    0x1(%rbp),%r15d
  lea    0x0(,%r15,4),%edi
  call   <libaft_malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%r12
  lea    0x0(%r13,%r13,2),%edi
  shl    $0x3,%edi
  call   <libaft_malloc@plt>
  mov    %rax,%r11
  mov    %rax,%rbx
  test   %r15d,%r15d
  jle    L247
L52:
  mov    0x8(%rsp),%rax
  mov    %rax,%rdx
  mov    %ebp,%ebp
  lea    0x4(%rax,%rbp,4),%rax
L274:
  movl   $0xffffffff,(%rdx)
  add    $0x4,%rdx
  cmp    %rax,%rdx
  jne    L274
L247:
  test   %r13d,%r13d
  jle    L222
  mov    %r14,0x18(%rsp)
  lea    0x0(%r13,%r13,2),%r10d
  mov    %r10d,0x24(%rsp)
  mov    %r14,%rsi
  mov    $0x0,%r8d
  jmp    L14
L218:
  add    $0x18,%r11
  add    $0x3,%r8d
  add    $0xc,%rsi
  cmp    %r10d,%r8d
  je     L200
L14:
  mov    %r8d,%r9d
  mov    %r11,%rcx
  mov    $0x1,%eax
  lea    -0x1(%r8),%edi
L91:
  movslq %eax,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  mov    %eax,%ebp
  sar    $0x1f,%ebp
  sub    %ebp,%edx
  lea    (%rdx,%rdx,2),%ebp
  mov    %eax,%edx
  sub    %ebp,%edx
  add    %r9d,%edx
  movslq %edx,%rdx
  mov    (%r14,%rdx,4),%edx
  mov    %edx,(%rcx)
  movslq -0x4(%rsi,%rax,4),%rdx
  mov    (%r12,%rdx,4),%edx
  mov    %edx,0x4(%rcx)
  movslq -0x4(%rsi,%rax,4),%rdx
  lea    (%rdi,%rax,1),%ebp
  mov    %ebp,(%r12,%rdx,4)
  add    $0x1,%rax
  add    $0x8,%rcx
  cmp    $0x4,%rax
  jne    L91
  jmp    L218
L200:
  mov    $0x0,%r15d
  movl   $0x0,0x28(%rsp)
  movl   $0x0,0x20(%rsp)
  jmp    L32
L26:
  mov    0x4(%rbx,%rax,4),%eax
  test   %eax,%eax
  js     L236
L149:
  add    %eax,%eax
  cltq
  cmp    %edx,(%rbx,%rax,4)
  jne    L26
  add    $0x1,%esi
  jmp    L26
L236:
  test   %esi,%esi
  je     L89
  cmp    $0x1,%esi
  jle    L205
  cmpl   $0x0,0x14(%rsp)
  jne    L22
L358:
  addl   $0x1,0x28(%rsp)
  jmp    L205
L89:
  cmpl   $0x0,0x14(%rsp)
  jne    L159
L39:
  addl   $0x1,0x20(%rsp)
L205:
  add    $0x4,%r13
  add    $0x1,%ebp
  cmp    $0x5,%ebp
  je     L292
L97:
  mov    0x0(%r13),%ecx
  movslq %ecx,%rax
  mov    (%r12,%rax,4),%eax
  test   %eax,%eax
  js     L89
  movslq %ebp,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  mov    %ebp,%esi
  sar    $0x1f,%esi
  sub    %esi,%edx
  lea    (%rdx,%rdx,2),%esi
  mov    %ebp,%edx
  sub    %esi,%edx
  add    0x8(%rsp),%edx
  movslq %edx,%rdx
  mov    (%r14,%rdx,4),%edx
  mov    $0x0,%esi
  jmp    L149
L159:
  movslq %ebp,%rax
  imul   $0x55555556,%rax,%rax
  shr    $0x20,%rax
  mov    %ebp,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,2),%edx
  mov    %ebp,%eax
  sub    %edx,%eax
  add    0x8(%rsp),%eax
  cltq
  mov    0x2c(%rsp),%edi
  mov    %edi,%edx
  add    (%r14,%rax,4),%edx
  lea    (%rcx,%rdi,1),%esi
  lea    D39(%rip),%rdi
  call   <libaft_3d_warn@plt>
  jmp    L39
L22:
  mov    0x2c(%rsp),%eax
  add    %eax,%edx
  add    %ecx,%eax
  mov    %esi,%ecx
  mov    %eax,%esi
  lea    D48(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L358
L292:
  add    $0x3,%r15d
  addq   $0xc,0x18(%rsp)
  cmp    0x24(%rsp),%r15d
  je     L189
L32:
  mov    %r15d,0x8(%rsp)
  mov    0x18(%rsp),%r13
  mov    $0x2,%ebp
  jmp    L97
L189:
  mov    %r12,%rdi
  call   <libaft_free@plt>
  mov    %rbx,%rdi
  call   <libaft_free@plt>
  mov    0x20(%rsp),%eax
  test   %eax,%eax
  jg     L140
L229:
  mov    0x20(%rsp),%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L140:
  mov    0x28(%rsp),%edx
  mov    %eax,%esi
  lea    D8(%rip),%rdi
  call   <libaft_3d_warn@plt>
  jmp    L229
L222:
  mov    %r12,%rdi
  call   <libaft_free@plt>
  mov    %rbx,%rdi
  call   <libaft_free@plt>
  movl   $0x0,0x20(%rsp)
  jmp    L229
L219:
  mov    $0x4,%edi
  call   <libaft_malloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%r12
  lea    0x0(%r13,%r13,2),%edi
  shl    $0x3,%edi
  call   <libaft_malloc@plt>
  mov    %rax,%r11
  mov    %rax,%rbx
  mov    0x14(%rsp),%ebp
  jmp    L52
```

tool_calls: name: retrieve_data
arguments: label: D26
data_type: string
name: retrieve_data
arguments: label: D28
data_type: string
name: retrieve_data
arguments: label: D39
data_type: string
name: retrieve_data
arguments: label: D48
data_type: string
name: retrieve_data
arguments: label: D8
data_type: string

tool: D26: Checking tri data.

tool: D28: max vertex index used: %d


tool: D39: Check: no pair for edge [%d %d]


tool: D48: warning: more then one pair for edge [%d %d] (actually  %d pairs)


tool: D8: Check: %d errors, %d warnings


assistant: ```c
int check_tri(int nF, int *face, int indshift, int verbose) {
  int i, j, k, p, nV = 0;
  int *vertex, *edge;
  int errors = 0, warnings = 0;
  if (verbose)
    printf("Checking tri data.\n");
  for (i = 0; i < nF; i++) {
    for (j = 0; j < 3; j++) {
      if (face[3 * i + j] > nV)
        nV = face[3 * i + j];
    }
  }
  if (verbose)
    printf("max vertex index used: %d\n", nV + indshift);
  nV++;
  vertex = (int *)libaft_malloc(sizeof(int) * nV);
  edge = (int *)libaft_malloc(2 * sizeof(int) * 3 * nF);
  for (i = 0; i < nV; i++) {
    vertex[i] = -1;
  }
  for (i = 0; i < nF; i++) {
    for (j = 0; j < 3; j++) {
      edge[2 * (3 * i + j)] = face[3 * i + (j + 1) % 3];
      edge[2 * (3 * i + j) + 1] = vertex[face[3 * i + j]];
      vertex[face[3 * i + j]] = 3 * i + j;
    }
  }
  for (i = 0; i < nF; i++) {
    for (j = 0; j < 3; j++) {
      k = vertex[face[3 * i + j]];
      p = 0;
      while (k >= 0) {
        if (edge[2 * k] == face[3 * i + (j + 2) % 3])
          p++;
        k = edge[2 * k + 1];
      }
      if (p == 0) {
        if (verbose)
          libaft_3d_warn("Check: no pair for edge [%d %d]\n", face[3 * i + j] + indshift, face[3 * i + (j + 2) % 3] + indshift);
        errors++;
      } else if (p > 1) {
        if (verbose)
          printf("warning: more then one pair for edge [%d %d] (actually  %d pairs)\n", face[3 * i + j] + indshift, face[3 * i + (j + 2) % 3] + indshift, p);
        warnings++;
      }
    }
  }
  libaft_free(vertex);
  libaft_free(edge);
  if (errors > 0)
    libaft_3d_warn("Check: %d errors, %d warnings\n", errors, warnings);
  return errors;
}
```