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

```asm
<tng_compress_pos_int>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,%r14
  mov    %esi,%r12d
  mov    %edx,%ebp
  mov    %rcx,0x18(%rsp)
  mov    %r8,0x20(%rsp)
  mov    %r9d,%r13d
  mov    0x90(%rsp),%rbx
  mov    0x98(%rsp),%rax
  mov    %rax,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  mov    %esi,%r15d
  imul   %edx,%r15d
  imul   $0xe,%r15d,%edi
  add    $0x2c,%edi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  lea    (%r15,%r15,2),%r15d
  shl    $0x2,%r15d
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %rax,(%rsp)
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %r13d,%r13d
  je     L219
  mov    $0x1,%r15d
  jg     L174
  jmp    L75
L219:
  mov    $0x2,%r13d
L174:
  mov    $0x6,%r15d
  cmp    %r15d,%r13d
  cmovle %r13d,%r15d
L75:
  mov    (%rbx),%eax
  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)
  mov    0x8(%rsp),%rcx
  mov    %ebp,%edx
  mov    %r12d,%esi
  mov    %r14,%rdi
  call   <quant_inter_differences@plt>
  mov    (%rsp),%rcx
  mov    %ebp,%edx
  mov    %r12d,%esi
  mov    %r14,%rdi
  call   <quant_intra_differences@plt>
  cmpl   $0xffffffff,0x38(%rsp)
  je     L43
  cmpl   $0xffffffff,0x3c(%rsp)
  je     L191
L53:
  cmp    $0x1,%ebp
  je     L185
  jle    L93
  cmpl   $0xffffffff,0x40(%rsp)
  je     L153
  cmpl   $0xffffffff,0x44(%rsp)
  je     L205
L93:
  push   0x10(%rsp)
  push   0x30(%rsp)
  push   0x30(%rsp)
  push   0x30(%rsp)
  mov    0x64(%rsp),%eax
  push   %rax
  mov    0x68(%rsp),%eax
  push   %rax
  mov    0x6c(%rsp),%eax
  push   %rax
  mov    0x70(%rsp),%eax
  push   %rax
  mov    %r15d,%r9d
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    0x40(%rsp),%rbp
  mov    %rbp,%rdx
  mov    0x48(%rsp),%r15
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <compress_quantized_pos@plt>
  add    $0x40,%rsp
  mov    %r15,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  cmpl   $0xffffffff,(%rbx)
  je     L184
L202:
  cmpl   $0xffffffff,0x4(%rbx)
  je     L32
L98:
  cmpl   $0xffffffff,0x8(%rbx)
  je     L220
L101:
  cmpl   $0xffffffff,0xc(%rbx)
  je     L173
L71:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L64
  mov    0x10(%rsp),%rax
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L43:
  movl   $0xffffffff,0x3c(%rsp)
  lea    0x3c(%rsp),%rax
  push   %rax
  lea    0x40(%rsp),%rax
  push   %rax
  mov    0x30(%rsp),%r9
  mov    0x28(%rsp),%r8
  mov    %r15d,%ecx
  mov    %r12d,%edx
  mov    0x10(%rsp),%rsi
  mov    %r14,%rdi
  call   <determine_best_pos_initial_coding@plt>
  add    $0x10,%rsp
  jmp    L53
L191:
  lea    0x3c(%rsp),%rax
  push   %rax
  lea    0x40(%rsp),%rax
  push   %rax
  mov    0x30(%rsp),%r9
  mov    0x28(%rsp),%r8
  mov    %r15d,%ecx
  mov    %r12d,%edx
  mov    0x10(%rsp),%rsi
  mov    %r14,%rdi
  call   <determine_best_pos_initial_coding@plt>
  add    $0x10,%rsp
  jmp    L53
L185:
  movl   $0x0,0x40(%rsp)
  movl   $0x0,0x44(%rsp)
  jmp    L93
L153:
  movl   $0xffffffff,0x44(%rsp)
  lea    0x44(%rsp),%rax
  push   %rax
  lea    0x48(%rsp),%rax
  push   %rax
  push   0x30(%rsp)
  push   0x30(%rsp)
  mov    %r15d,%r9d
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    0x20(%rsp),%rdx
  mov    0x28(%rsp),%rsi
  mov    %r14,%rdi
  call   <determine_best_pos_coding@plt>
  add    $0x20,%rsp
  jmp    L93
L205:
  lea    0x44(%rsp),%rax
  push   %rax
  lea    0x48(%rsp),%rax
  push   %rax
  push   0x30(%rsp)
  push   0x30(%rsp)
  mov    %r15d,%r9d
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    0x20(%rsp),%rdx
  mov    0x28(%rsp),%rsi
  mov    %r14,%rdi
  call   <determine_best_pos_coding@plt>
  add    $0x20,%rsp
  jmp    L93
L184:
  mov    0x38(%rsp),%eax
  mov    %eax,(%rbx)
  jmp    L202
L32:
  mov    0x3c(%rsp),%eax
  mov    %eax,0x4(%rbx)
  jmp    L98
L220:
  mov    0x40(%rsp),%eax
  mov    %eax,0x8(%rbx)
  jmp    L101
L173:
  mov    0x44(%rsp),%eax
  mov    %eax,0xc(%rbx)
  jmp    L71
L64:
  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;
}
```