user: Converte this assembly snippet into its equivalent C code:

```asm
<change_basis_tricli>:
  endbr64
  push   %r14
  mulsd  %xmm0,%xmm0
  push   %r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x148,%rsp
  movupd (%rsi),%xmm4
  movupd 0x10(%rsi),%xmm5
  movupd 0x20(%rsi),%xmm6
  movupd 0x30(%rsi),%xmm7
  mov    %rsp,%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x138(%rsp)
  xor    %eax,%eax
  movsd  0x40(%rsi),%xmm1
  movaps %xmm4,(%rsp)
  movaps %xmm5,0x10(%rsp)
  movaps %xmm6,0x20(%rsp)
  movaps %xmm7,0x30(%rsp)
  movsd  %xmm1,0x40(%rsp)
  call   <niggli_reduce@plt>
  test   %eax,%eax
  je     L28
  movapd (%rsp),%xmm4
  movapd 0x10(%rsp),%xmm5
  lea    0x50(%rsp),%r14
  movapd 0x20(%rsp),%xmm6
  movapd 0x30(%rsp),%xmm7
  mov    %r14,%rdi
  movsd  0x40(%rsp),%xmm0
  movaps %xmm4,0x50(%rsp)
  movaps %xmm5,0x60(%rsp)
  movaps %xmm6,0x70(%rsp)
  movaps %xmm7,0x80(%rsp)
  movsd  %xmm0,0x90(%rsp)
  call   <mat_get_determinant_d3@plt>
  test   %rax,%rax
  js     L36
L12:
  lea    0xa0(%rsp),%r13
  mov    %r12,%rsi
  xor    %edx,%edx
  mov    %r13,%rdi
  lea    0xf0(%rsp),%r12
  call   <mat_inverse_matrix_d3@plt>
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <mat_multiply_matrix_d3@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <mat_cast_matrix_3d_to_3i@plt>
  mov    $0x1,%eax
L28:
  mov    0x138(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L34
  add    $0x148,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L36:
  movapd D12(%rip),%xmm0
  movapd 0x60(%rsp),%xmm2
  movapd 0x70(%rsp),%xmm1
  movapd 0x50(%rsp),%xmm3
  xorpd  %xmm0,%xmm2
  xorpd  %xmm0,%xmm1
  xorpd  %xmm0,%xmm3
  movaps %xmm2,0x60(%rsp)
  xorpd  0x80(%rsp),%xmm0
  movaps %xmm3,0x50(%rsp)
  movaps %xmm0,0x80(%rsp)
  movsd  0x90(%rsp),%xmm0
  xorpd  D13(%rip),%xmm0
  movaps %xmm1,0x70(%rsp)
  movsd  %xmm0,0x90(%rsp)
  jmp    L12
L34:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D12
type_infered: byte[16]
name: disassemble_data
arguments: tag: D13
type_infered: byte[16]

tool: {"D12": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

tool: {"D13": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
int change_basis_tricli(int int_transform_mat[3][3], double conv_lattice[3][3], double primitive_lattice[3][3], const double symprec) {
  int i, j;
  double niggli_cell[9];
  double smallest_lattice[3][3], inv_lattice[3][3], transform_mat[3][3];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      niggli_cell[i * 3 + j] = conv_lattice[i][j];
    }
  }
  if (!niggli_reduce(niggli_cell, symprec * symprec)) {
    return 0;
  }
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      smallest_lattice[i][j] = niggli_cell[i * 3 + j];
    }
  }
  if (mat_get_determinant_d3(smallest_lattice) < 0) {
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        smallest_lattice[i][j] = -smallest_lattice[i][j];
      }
    }
  }
  mat_inverse_matrix_d3(inv_lattice, primitive_lattice, 0);
  mat_multiply_matrix_d3(transform_mat, inv_lattice, smallest_lattice);
  mat_cast_matrix_3d_to_3i(int_transform_mat, transform_mat);
  return 1;
}
```