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

```asm
<check>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %edx,-0x50(%rbp)
  mov    %ecx,-0x54(%rbp)
  mov    %r8d,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x38(%rbp)
  mov    -0x50(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <alloca@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <alloca@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x58(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <alloca@plt>
  mov    %rax,-0x10(%rbp)
  movl   $0x0,-0x30(%rbp)
  mov    -0x50(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x54(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x58(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L79
L58:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sar    $0x10,%eax
  and    $0xff,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sar    $0x8,%eax
  and    $0xff,%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  and    $0xff,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x2c(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jge    L93
  mov    -0x28(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jge    L93
  mov    -0x24(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L51
L93:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x1,-0x38(%rbp)
  jmp    L171
L51:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
L171:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sar    $0x18,%eax
  add    %eax,-0x30(%rbp)
  addl   $0x1,-0x34(%rbp)
L79:
  mov    -0x34(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L58
  cmpl   $0x0,-0x30(%rbp)
  jne    L75
  mov    $0x0,%eax
  jmp    L21
L75:
  mov    -0x30(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  je     L180
  mov    -0x4c(%rbp),%edx
  mov    -0x30(%rbp),%eax
  mov    %eax,%esi
  lea    D34(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L21
L180:
  movl   $0x0,-0x34(%rbp)
  jmp    L63
L113:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L128
  mov    -0x20(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x34(%rbp),%eax
  mov    %eax,%esi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x1,-0x38(%rbp)
L128:
  addl   $0x1,-0x34(%rbp)
L63:
  mov    -0x34(%rbp),%eax
  cmp    -0x50(%rbp),%eax
  jl     L113
  movl   $0x0,-0x34(%rbp)
  jmp    L30
L135:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L159
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x34(%rbp),%eax
  mov    %eax,%esi
  lea    D31(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x1,-0x38(%rbp)
L159:
  addl   $0x1,-0x34(%rbp)
L30:
  mov    -0x34(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L135
  movl   $0x0,-0x34(%rbp)
  jmp    L179
L125:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L106
  mov    -0x10(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x34(%rbp),%eax
  mov    %eax,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x1,-0x38(%rbp)
L106:
  addl   $0x1,-0x34(%rbp)
L179:
  mov    -0x34(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L125
  mov    -0x38(%rbp),%eax
L21:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L167
  call   <__stack_chk_fail@plt>
L167:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D33
type_guessed: string
name: unpack_data
arguments: data_tag: D34
type_guessed: string
name: unpack_data
arguments: data_tag: D5
type_guessed: string
name: unpack_data
arguments: data_tag: D31
type_guessed: string
name: unpack_data
arguments: data_tag: D2
type_guessed: string

tool: D33: unexpected cpu %#x used


tool: D34: offloaded %d times,  expected %d


tool: D5: gang %d not used %d times


tool: D31: worker %d not used %d times


tool: D2: vector %d not used %d times


assistant: ```c
int check(const int *ary, int size, int gp, int wp, int vp) {
  int exit = 0;
  int ix;
  int *gangs = (int *)alloca(gp * sizeof(int));
  int *workers = (int *)alloca(wp * sizeof(int));
  int *vectors = (int *)alloca(vp * sizeof(int));
  int offloaded = 0;
  memset(gangs, 0, gp * sizeof(int));
  memset(workers, 0, wp * sizeof(int));
  memset(vectors, 0, vp * sizeof(int));
  for (ix = 0; ix < size; ix++) {
    int g = (ary[ix] >> 16) & 0xff;
    int w = (ary[ix] >> 8) & 0xff;
    int v = (ary[ix] >> 0) & 0xff;
    if (g >= gp || w >= wp || v >= vp) {
      printf("unexpected cpu %#x used\n", ary[ix]);
      exit = 1;
    } else {
      vectors[v]++;
      workers[w]++;
      gangs[g]++;
    }
    offloaded += ary[ix] >> 24;
  }
  if (!offloaded)
    return 0;
  if (offloaded != size) {
    printf("offloaded %d times,  expected %d\n", offloaded, size);
    return 1;
  }
  for (ix = 0; ix < gp; ix++)
    if (gangs[ix] != gangs[0]) {
      printf("gang %d not used %d times\n", ix, gangs[0]);
      exit = 1;
    }
  for (ix = 0; ix < wp; ix++)
    if (workers[ix] != workers[0]) {
      printf("worker %d not used %d times\n", ix, workers[0]);
      exit = 1;
    }
  for (ix = 0; ix < vp; ix++)
    if (vectors[ix] != vectors[0]) {
      printf("vector %d not used %d times\n", ix, vectors[0]);
      exit = 1;
    }
  return exit;
}
```