user: Demonstrate the C code that generates the assembly output below:

```asm
<get_BZ_triplets_at_q>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x98,%rsp
  mov    %rdi,%r14
  mov    %esi,%r13d
  mov    %rdx,0x20(%rsp)
  mov    %rcx,%r12
  mov    %r8,%rbp
  mov    %r9d,%ebx
  mov    0xd0(%rsp),%rcx
  mov    %rcx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  mov    (%rcx),%eax
  add    %eax,%eax
  mov    %eax,0x54(%rsp)
  mov    0x4(%rcx),%eax
  add    %eax,%eax
  mov    %eax,0x58(%rsp)
  mov    0x8(%rcx),%eax
  mov    %eax,0x10(%rsp)
  add    %eax,%eax
  mov    %eax,0x5c(%rsp)
  lea    0x0(,%r9,4),%edi
  call   <malloc@plt>
  mov    %rax,0x30(%rsp)
  test   %ebx,%ebx
  jle    L62
  mov    %rax,%rsi
  mov    %ebx,%ebx
  mov    $0x0,%eax
  mov    $0x0,%edx
  jmp    L122
L100:
  add    $0x1,%rax
  cmp    %rbx,%rax
  je     L96
L122:
  cmp    %eax,0x0(%rbp,%rax,4)
  jne    L100
  movslq %edx,%rcx
  mov    %eax,(%rsi,%rcx,4)
  add    $0x1,%edx
  jmp    L100
L96:
  mov    %edx,0x3c(%rsp)
  test   %edx,%edx
  jle    L33
  movslq %r13d,%r13
  lea    0x0(%r13,%r13,2),%rax
  mov    0x20(%rsp),%rcx
  lea    (%rcx,%rax,4),%r15
  mov    %r14,0x10(%rsp)
  mov    0x30(%rsp),%rcx
  mov    %rcx,%r14
  lea    -0x1(%rdx),%eax
  lea    0x4(%rcx,%rax,4),%rax
  mov    %rax,0x28(%rsp)
  lea    0x54(%rsp),%r13
  jmp    L42
L85:
  lea    0x24(%rbx),%rax
  mov    0x10(%rsp),%rbp
  mov    %r14,0x18(%rsp)
  mov    %rax,%r14
L70:
  mov    (%rbx),%eax
  add    %eax,%eax
  mov    %eax,0x48(%rsp)
  mov    0x4(%rbx),%eax
  add    %eax,%eax
  mov    %eax,0x4c(%rsp)
  mov    0x8(%rbx),%eax
  add    %eax,%eax
  mov    %eax,0x50(%rsp)
  lea    0x48(%rsp),%rdi
  mov    %r13,%rsi
  call   <kpt_get_grid_point_double_mesh@plt>
  mov    (%r12,%rax,4),%eax
  mov    %eax,0x0(%rbp)
  add    $0xc,%rbx
  add    $0x4,%rbp
  cmp    %r14,%rbx
  jne    L70
  mov    0x18(%rsp),%r14
  addq   $0xc,0x10(%rsp)
  add    $0x4,%r14
  cmp    0x28(%rsp),%r14
  je     L33
L42:
  mov    %r14,%rdi
  lea    0x60(%rsp),%rbx
  mov    %rbx,%rcx
  mov    $0x0,%edx
  mov    0x20(%rsp),%r8
L120:
  mov    (%r15,%rdx,4),%eax
  mov    %eax,(%rcx)
  movslq (%rdi),%rsi
  lea    (%rsi,%rsi,2),%rsi
  lea    (%r8,%rsi,4),%rsi
  movslq %edx,%r9
  mov    (%rsi,%r9,4),%esi
  mov    %esi,0xc(%rcx)
  neg    %eax
  sub    %esi,%eax
  mov    %eax,0x18(%rcx)
  add    $0x1,%rdx
  add    $0x4,%rcx
  cmp    $0x3,%rdx
  jne    L120
  mov    $0x2,%ebp
L132:
  lea    0x60(%rsp),%rdi
  mov    %r13,%r8
  mov    0x8(%rsp),%rcx
  mov    %r12,%rdx
  mov    %ebp,%esi
  call   <get_third_q_of_triplets_at_q@plt>
  test   %rax,%rax
  je     L85
  sub    $0x1,%ebp
  cmp    $0xffffffff,%ebp
  jne    L132
  jmp    L85
L62:
  movl   $0x0,0x3c(%rsp)
L33:
  mov    0x30(%rsp),%rdi
  call   <free@plt>
  mov    0x88(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L78
  mov    0x3c(%rsp),%eax
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L78:
  call   <__stack_chk_fail@plt>
```

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;
}
```