user: Translate the below assembly code into C programming language:

```asm
<insert_batch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  mov    %r9d,-0x30(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x30(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x30(%rbp)
  je     L66
  movl   $0x0,-0x18(%rbp)
  jmp    L61
L42:
  mov    -0x14(%rbp),%ecx
  mov    -0x18(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %ecx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x10(%rbp),%ecx
  mov    -0x18(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %ecx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0xc(%rbp),%ecx
  mov    -0x18(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    %ecx,%eax
  mov    %eax,-0xc(%rbp)
  addl   $0x1,-0x18(%rbp)
L61:
  mov    -0x18(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jl     L42
  jmp    L66
L3:
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  sub    %eax,%edx
  mov    -0x14(%rbp),%ecx
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x48(%rbp),%rax
  add    %rsi,%rax
  sub    %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x40(%rbp),%rdx
  add    $0x4,%rdx
  mov    (%rdx),%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%ecx
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rsi
  mov    -0x48(%rbp),%rax
  add    %rsi,%rax
  sub    %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x40(%rbp),%rdx
  add    $0x8,%rdx
  mov    (%rdx),%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%ecx
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rsi
  mov    -0x48(%rbp),%rax
  add    %rsi,%rax
  sub    %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x40(%rbp),%rdx
  add    $0x4,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x2,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x40(%rbp),%rdx
  add    $0x8,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  mov    %eax,-0xc(%rbp)
  addl   $0x3,-0x1c(%rbp)
L66:
  cmpl   $0x14,-0x1c(%rbp)
  jg     L47
  mov    -0x2c(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cmp    %eax,-0x1c(%rbp)
  jl     L3
L47:
  mov    -0x50(%rbp),%rax
  mov    -0x1c(%rbp),%edx
  mov    %edx,(%rax)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L65
  call   <__stack_chk_fail@plt>
L65:
  leave
  ret
```

assistant: ```c
void insert_batch(int *input_ptr, int ntriplets_left, const int *prevcoord, int *minint, int *encode_ints, const int startenc, int *nenc) {
  int nencode = startenc * 3;
  int tmp_prevcoord[3];
  tmp_prevcoord[0] = prevcoord[0];
  tmp_prevcoord[1] = prevcoord[1];
  tmp_prevcoord[2] = prevcoord[2];
  if (startenc) {
    int i;
    for (i = 0; i < startenc; i++) {
      tmp_prevcoord[0] += encode_ints[i * 3];
      tmp_prevcoord[1] += encode_ints[i * 3 + 1];
      tmp_prevcoord[2] += encode_ints[i * 3 + 2];
    }
  }
  while ((nencode < 21) && (nencode < ntriplets_left * 3)) {
    encode_ints[nencode] = input_ptr[nencode] - minint[0] - tmp_prevcoord[0];
    encode_ints[nencode + 1] = input_ptr[nencode + 1] - minint[1] - tmp_prevcoord[1];
    encode_ints[nencode + 2] = input_ptr[nencode + 2] - minint[2] - tmp_prevcoord[2];
    tmp_prevcoord[0] = input_ptr[nencode] - minint[0];
    tmp_prevcoord[1] = input_ptr[nencode + 1] - minint[1];
    tmp_prevcoord[2] = input_ptr[nencode + 2] - minint[2];
    nencode += 3;
  }
  *nenc = nencode;
}
```