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

```asm
<change_basis_tricli>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x170,%rsp
  mov    %rdi,-0x158(%rbp)
  mov    %rsi,-0x160(%rbp)
  mov    %rdx,-0x168(%rbp)
  movsd  %xmm0,-0x170(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x148(%rbp)
  jmp    L155
L147:
  movl   $0x0,-0x144(%rbp)
  jmp    L44
L70:
  mov    -0x148(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  shl    $0x3,%rax
  mov    %rax,%rdx
  mov    -0x160(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x148(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %eax,%edx
  mov    -0x144(%rbp),%eax
  add    %eax,%edx
  mov    -0x144(%rbp),%eax
  cltq
  movsd  (%rcx,%rax,8),%xmm0
  movslq %edx,%rax
  movsd  %xmm0,-0x140(%rbp,%rax,8)
  addl   $0x1,-0x144(%rbp)
L44:
  cmpl   $0x2,-0x144(%rbp)
  jle    L70
  addl   $0x1,-0x148(%rbp)
L155:
  cmpl   $0x2,-0x148(%rbp)
  jle    L147
  movsd  -0x170(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  movq   %xmm0,%rdx
  lea    -0x140(%rbp),%rax
  movq   %rdx,%xmm0
  mov    %rax,%rdi
  call   <niggli_reduce@plt>
  test   %eax,%eax
  jne    L46
  mov    $0x0,%eax
  jmp    L22
L46:
  movl   $0x0,-0x148(%rbp)
  jmp    L97
L47:
  movl   $0x0,-0x144(%rbp)
  jmp    L157
L30:
  mov    -0x148(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %eax,%edx
  mov    -0x144(%rbp),%eax
  add    %edx,%eax
  cltq
  movsd  -0x140(%rbp,%rax,8),%xmm0
  mov    -0x144(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x148(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  movsd  %xmm0,-0xf0(%rbp,%rax,8)
  addl   $0x1,-0x144(%rbp)
L157:
  cmpl   $0x2,-0x144(%rbp)
  jle    L30
  addl   $0x1,-0x148(%rbp)
L97:
  cmpl   $0x2,-0x148(%rbp)
  jle    L47
  lea    -0xf0(%rbp),%rax
  mov    %rax,%rdi
  call   <mat_get_determinant_d3@plt>
  test   %rax,%rax
  jns    L151
  movl   $0x0,-0x148(%rbp)
  jmp    L10
L3:
  movl   $0x0,-0x144(%rbp)
  jmp    L73
L33:
  mov    -0x144(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x148(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  movsd  -0xf0(%rbp,%rax,8),%xmm0
  movq   D5(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  mov    -0x144(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x148(%rbp),%eax
  movslq %eax,%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  add    %rcx,%rax
  movsd  %xmm0,-0xf0(%rbp,%rax,8)
  addl   $0x1,-0x144(%rbp)
L73:
  cmpl   $0x2,-0x144(%rbp)
  jle    L33
  addl   $0x1,-0x148(%rbp)
L10:
  cmpl   $0x2,-0x148(%rbp)
  jle    L3
L151:
  mov    -0x168(%rbp),%rcx
  lea    -0xa0(%rbp),%rax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <mat_inverse_matrix_d3@plt>
  lea    -0xf0(%rbp),%rdx
  lea    -0xa0(%rbp),%rcx
  lea    -0x50(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <mat_multiply_matrix_d3@plt>
  lea    -0x50(%rbp),%rdx
  mov    -0x158(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <mat_cast_matrix_3d_to_3i@plt>
  mov    $0x1,%eax
L22:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L116
  call   <__stack_chk_fail@plt>
L116:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D5
data_type: byte[8]

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

assistant: ```c
int change_basis_tricli(int tmat_int[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], tmat[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(tmat, inv_lattice, smallest_lattice);
  mat_cast_matrix_3d_to_3i(tmat_int, tmat);
  return 1;
}
```