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

```asm
<get_BZ_triplets_at_q>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %esi,-0x6c(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %rcx,-0x80(%rbp)
  mov    %r8,-0x88(%rbp)
  mov    %r9d,-0x70(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x90(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x60(%rbp)
  jmp    L102
L9:
  mov    -0x60(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x90(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x60(%rbp),%eax
  cltq
  mov    %edx,-0x3c(%rbp,%rax,4)
  addl   $0x1,-0x60(%rbp)
L102:
  cmpl   $0x2,-0x60(%rbp)
  jle    L9
  movl   $0x0,-0x54(%rbp)
  mov    -0x70(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x50(%rbp)
  movl   $0x0,-0x60(%rbp)
  jmp    L150
L84:
  mov    -0x60(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x60(%rbp)
  jne    L49
  mov    -0x54(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rax,%rdx
  mov    -0x60(%rbp),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x54(%rbp)
L49:
  addl   $0x1,-0x60(%rbp)
L150:
  mov    -0x60(%rbp),%eax
  cmp    -0x70(%rbp),%eax
  jl     L84
  movl   $0x0,-0x60(%rbp)
  jmp    L22
L17:
  movl   $0x0,-0x5c(%rbp)
  jmp    L38
L47:
  mov    -0x6c(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rax,%rdx
  mov    -0x5c(%rbp),%eax
  cltq
  mov    (%rdx,%rax,4),%edx
  mov    -0x5c(%rbp),%eax
  cltq
  mov    %edx,-0x30(%rbp,%rax,4)
  mov    -0x60(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rax,%rdx
  mov    -0x5c(%rbp),%eax
  cltq
  mov    (%rdx,%rax,4),%eax
  mov    -0x5c(%rbp),%edx
  movslq %edx,%rdx
  add    $0x3,%rdx
  mov    %eax,-0x30(%rbp,%rdx,4)
  mov    -0x5c(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,4),%eax
  neg    %eax
  mov    %eax,%edx
  mov    -0x5c(%rbp),%eax
  cltq
  add    $0x3,%rax
  mov    -0x30(%rbp,%rax,4),%eax
  sub    %eax,%edx
  mov    -0x5c(%rbp),%eax
  cltq
  add    $0x6,%rax
  mov    %edx,-0x30(%rbp,%rax,4)
  addl   $0x1,-0x5c(%rbp)
L38:
  cmpl   $0x2,-0x5c(%rbp)
  jle    L47
  movl   $0x2,-0x5c(%rbp)
  jmp    L136
L113:
  lea    -0x3c(%rbp),%rdi
  mov    -0x90(%rbp),%rcx
  mov    -0x80(%rbp),%rdx
  mov    -0x5c(%rbp),%esi
  lea    -0x30(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <get_third_q_of_triplets_at_q@plt>
  test   %rax,%rax
  je     L94
  subl   $0x1,-0x5c(%rbp)
L136:
  cmpl   $0x0,-0x5c(%rbp)
  jns    L113
  jmp    L31
L94:
  nop
L31:
  movl   $0x0,-0x5c(%rbp)
  jmp    L127
L53:
  movl   $0x0,-0x58(%rbp)
  jmp    L161
L107:
  mov    -0x58(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  mov    -0x30(%rbp,%rax,4),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x58(%rbp),%eax
  cltq
  mov    %edx,-0x48(%rbp,%rax,4)
  addl   $0x1,-0x58(%rbp)
L161:
  cmpl   $0x2,-0x58(%rbp)
  jle    L107
  lea    -0x3c(%rbp),%rdx
  lea    -0x48(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <kpt_get_grid_point_double_mesh@plt>
  lea    0x0(,%rax,4),%rdx
  mov    -0x80(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x60(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x2,%rax
  mov    %rax,%rdx
  mov    -0x68(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    (%rsi),%edx
  mov    -0x5c(%rbp),%eax
  cltq
  mov    %edx,(%rcx,%rax,4)
  addl   $0x1,-0x5c(%rbp)
L127:
  cmpl   $0x2,-0x5c(%rbp)
  jle    L53
  addl   $0x1,-0x60(%rbp)
L22:
  mov    -0x60(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L17
  mov    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x54(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L27
  call   <__stack_chk_fail@plt>
L27:
  leave
  ret
```

assistant: ```c
int get_BZ_triplets_at_q(int triplets[][3], const int grid_point, int bz_grid_address[][3], const int bz_map[], const int map_triplets[], const int num_map_triplets, const int mesh[3]) {
  int i, j, k, num_ir;
  int bz_address[3][3], bz_address_double[3], bzmesh[3];
  int *ir_grid_points;
  for (i = 0; i < 3; i++) {
    bzmesh[i] = mesh[i] * 2;
  }
  num_ir = 0;
  ir_grid_points = (int *)malloc(sizeof(int) * num_map_triplets);
  for (i = 0; i < num_map_triplets; i++) {
    if (map_triplets[i] == i) {
      ir_grid_points[num_ir] = i;
      num_ir++;
    }
  }
#pragma omp parallel for private(j, k, bz_address, bz_address_double)
  for (i = 0; i < num_ir; i++) {
    for (j = 0; j < 3; j++) {
      bz_address[0][j] = bz_grid_address[grid_point][j];
      bz_address[1][j] = bz_grid_address[ir_grid_points[i]][j];
      bz_address[2][j] = -bz_address[0][j] - bz_address[1][j];
    }
    for (j = 2; j > -1; j--) {
      if (get_third_q_of_triplets_at_q(bz_address, j, bz_map, mesh, bzmesh) == 0) {
        break;
      }
    }
    for (j = 0; j < 3; j++) {
      for (k = 0; k < 3; k++) {
        bz_address_double[k] = bz_address[j][k] * 2;
      }
      triplets[i][j] = bz_map[kpt_get_grid_point_double_mesh(bz_address_double, bzmesh)];
    }
  }
  free(ir_grid_points);
  return num_ir;
}
```