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

```asm
<tng_compress_pos_int>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  imul   %edx,%r13d
  mov    %esi,%r12d
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  imul   $0xe,%r13d,%edi
  sub    $0x58,%rsp
  mov    0x98(%rsp),%rax
  mov    %r9d,0x2c(%rsp)
  add    $0x2c,%edi
  mov    %rcx,0x10(%rsp)
  mov    0x90(%rsp),%rbx
  mov    %r8,0x18(%rsp)
  mov    %rax,0x20(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <malloc@plt>
  lea    0x0(%r13,%r13,2),%edi
  lea    0x0(,%rdi,4),%r15d
  mov    %rax,0x8(%rsp)
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %r15d,%edi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    0x2c(%rsp),%r9d
  mov    $0x2,%r11d
  mov    %rax,%r15
  test   %r9d,%r9d
  je     L74
  mov    $0x6,%r11d
  mov    $0x1,%eax
  cmp    %r11d,%r9d
  cmovle %r9d,%r11d
  test   %r9d,%r9d
  cmovle %eax,%r11d
L74:
  mov    (%rbx),%eax
  mov    %r15,%rcx
  mov    %ebp,%edx
  mov    %r12d,%esi
  mov    %r14,%rdi
  mov    %r11d,0x2c(%rsp)
  mov    %eax,0x38(%rsp)
  mov    0x4(%rbx),%eax
  mov    %eax,0x3c(%rsp)
  mov    0x8(%rbx),%eax
  mov    %eax,0x40(%rsp)
  mov    0xc(%rbx),%eax
  mov    %eax,0x44(%rsp)
  call   <quant_inter_differences@plt>
  mov    %r13,%rcx
  mov    %ebp,%edx
  mov    %r12d,%esi
  mov    %r14,%rdi
  call   <quant_intra_differences@plt>
  cmpl   $0xffffffff,0x38(%rsp)
  mov    0x2c(%rsp),%r11d
  je     L126
  cmpl   $0xffffffff,0x3c(%rsp)
  je     L125
  cmp    $0x1,%ebp
  je     L25
L50:
  mov    0x40(%rsp),%eax
  mov    0x44(%rsp),%edx
  jle    L65
  cmp    $0xffffffff,%eax
  je     L49
  mov    0x44(%rsp),%edx
  cmp    $0xffffffff,%edx
  je     L145
L65:
  push   0x8(%rsp)
  mov    %r11d,%r9d
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  push   0x28(%rsp)
  mov    %r15,%rsi
  mov    %r14,%rdi
  push   0x28(%rsp)
  push   0x28(%rsp)
  push   %rdx
  mov    %r13,%rdx
  push   %rax
  mov    0x6c(%rsp),%eax
  push   %rax
  mov    0x70(%rsp),%eax
  push   %rax
  call   <compress_quantized_pos@plt>
  add    $0x40,%rsp
  mov    %r15,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  cmpl   $0xffffffff,(%rbx)
  jne    L129
  mov    0x38(%rsp),%eax
  mov    %eax,(%rbx)
L129:
  cmpl   $0xffffffff,0x4(%rbx)
  jne    L89
  mov    0x3c(%rsp),%eax
  mov    %eax,0x4(%rbx)
L89:
  cmpl   $0xffffffff,0x8(%rbx)
  jne    L143
  mov    0x40(%rsp),%eax
  mov    %eax,0x8(%rbx)
L143:
  cmpl   $0xffffffff,0xc(%rbx)
  jne    L8
  mov    0x44(%rsp),%eax
  mov    %eax,0xc(%rbx)
L8:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L136
  mov    0x8(%rsp),%rax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L49:
  movl   $0xffffffff,0x44(%rsp)
L145:
  lea    0x44(%rsp),%rax
  mov    %r11d,%r9d
  mov    %r13,%rdx
  mov    %ebp,%r8d
  push   %rax
  mov    %r12d,%ecx
  mov    %r15,%rsi
  mov    %r14,%rdi
  lea    0x48(%rsp),%rax
  push   %rax
  push   0x28(%rsp)
  push   0x28(%rsp)
  mov    %r11d,0x4c(%rsp)
  call   <determine_best_pos_coding@plt>
  mov    0x64(%rsp),%edx
  mov    0x60(%rsp),%eax
  add    $0x20,%rsp
  mov    0x2c(%rsp),%r11d
  jmp    L65
  xchg   %ax,%ax
L126:
  movl   $0xffffffff,0x3c(%rsp)
L125:
  lea    0x3c(%rsp),%rax
  mov    %r11d,%ecx
  mov    %r12d,%edx
  mov    %r13,%rsi
  push   %rax
  mov    %r14,%rdi
  lea    0x40(%rsp),%rax
  push   %rax
  mov    0x28(%rsp),%r9
  mov    0x20(%rsp),%r8
  mov    %r11d,0x3c(%rsp)
  call   <determine_best_pos_initial_coding@plt>
  pop    %rax
  pop    %rdx
  mov    0x2c(%rsp),%r11d
  cmp    $0x1,%ebp
  jne    L50
L25:
  movl   $0x0,0x40(%rsp)
  xor    %eax,%eax
  xor    %edx,%edx
  movl   $0x0,0x44(%rsp)
  jmp    L65
L136:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *tng_compress_pos_int(int *pos, const int natoms, const int nframes, const unsigned long prec_hi, const unsigned long prec_lo, int speed, int *algo, int *nitems) {
  char *data = malloc(natoms * nframes * 14 + 11 * 4);
  int *quant = pos;
  int *quant_intra = malloc(natoms * nframes * 3 * sizeof *quant_intra);
  int *quant_inter = malloc(natoms * nframes * 3 * sizeof *quant_inter);
  int initial_coding, initial_coding_parameter;
  int coding, coding_parameter;
  if (speed == 0)
    speed = 2;
  if (speed < 1)
    speed = 1;
  if (speed > 6)
    speed = 6;
  initial_coding = algo[0];
  initial_coding_parameter = algo[1];
  coding = algo[2];
  coding_parameter = algo[3];
  quant_inter_differences(quant, natoms, nframes, quant_inter);
  quant_intra_differences(quant, natoms, nframes, quant_intra);
  if (initial_coding == -1) {
    initial_coding_parameter = -1;
    determine_best_pos_initial_coding(quant, quant_intra, natoms, speed, prec_hi, prec_lo, &initial_coding, &initial_coding_parameter);
  } else if (initial_coding_parameter == -1) {
    determine_best_pos_initial_coding(quant, quant_intra, natoms, speed, prec_hi, prec_lo, &initial_coding, &initial_coding_parameter);
  }
  if (nframes == 1) {
    coding = 0;
    coding_parameter = 0;
  }
  if (nframes > 1) {
    if (coding == -1) {
      coding_parameter = -1;
      determine_best_pos_coding(quant, quant_inter, quant_intra, natoms, nframes, speed, prec_hi, prec_lo, &coding, &coding_parameter);
    } else if (coding_parameter == -1) {
      determine_best_pos_coding(quant, quant_inter, quant_intra, natoms, nframes, speed, prec_hi, prec_lo, &coding, &coding_parameter);
    }
  }
  compress_quantized_pos(quant, quant_inter, quant_intra, natoms, nframes, speed, initial_coding, initial_coding_parameter, coding, coding_parameter, prec_hi, prec_lo, nitems, data);
  free(quant_inter);
  free(quant_intra);
  if (algo[0] == -1)
    algo[0] = initial_coding;
  if (algo[1] == -1)
    algo[1] = initial_coding_parameter;
  if (algo[2] == -1)
    algo[2] = coding;
  if (algo[3] == -1)
    algo[3] = coding_parameter;
  return data;
}
```