user: 请从给定的汇编指令推导出C源代码：

```asm
<calc_prob_dp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x40(%rbp)
  mov    %r8d,-0x4c(%rbp)
  mov    %r9,-0x58(%rbp)
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  neg    %eax
  mov    %eax,%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x4c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  cmpl   $0x0,0x18(%rbp)
  jne    L19
  mov    -0x20(%rbp),%r9d
  mov    -0x4c(%rbp),%r8d
  mov    -0x40(%rbp),%ecx
  mov    -0x48(%rbp),%rdx
  mov    -0x3c(%rbp),%esi
  mov    -0x38(%rbp),%rax
  push   0x30(%rbp)
  mov    0x28(%rbp),%edi
  push   %rdi
  mov    0x20(%rbp),%edi
  push   %rdi
  mov    -0x1c(%rbp),%edi
  push   %rdi
  mov    %rax,%rdi
  call   <calc_prob_region_dp@plt>
  add    $0x20,%rsp
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L7
L19:
  movl   $0x0,-0x28(%rbp)
  mov    -0x4c(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L54
L17:
  mov    -0x30(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jge    L31
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  sub    -0x28(%rbp),%eax
  add    $0x1,%eax
  jmp    L27
L31:
  mov    -0x3c(%rbp),%eax
  sub    -0x28(%rbp),%eax
L27:
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x14(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0x14(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x24(%rbp),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x18(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L38
L37:
  mov    -0x18(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x3c(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rax,%rcx
  mov    -0x18(%rbp),%eax
  imul   -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rsi
  mov    -0x8(%rbp),%rax
  add    %rsi,%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  addl   $0x1,-0x2c(%rbp)
L38:
  cmpl   $0x14,-0x2c(%rbp)
  jle    L37
  mov    -0x20(%rbp),%r9d
  mov    -0x24(%rbp),%r8d
  mov    -0x40(%rbp),%ecx
  mov    -0x48(%rbp),%rdx
  mov    -0x18(%rbp),%esi
  mov    -0x8(%rbp),%rax
  push   0x30(%rbp)
  mov    0x28(%rbp),%edi
  push   %rdi
  mov    0x20(%rbp),%edi
  push   %rdi
  mov    -0x1c(%rbp),%edi
  push   %rdi
  mov    %rax,%rdi
  call   <calc_prob_region_dp@plt>
  add    $0x20,%rsp
  movsd  -0x10(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movq   $0x0,-0x8(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%eax
  add    %edx,%eax
  add    %eax,-0x24(%rbp)
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  add    $0x1,%eax
  mov    %eax,-0x28(%rbp)
  addl   $0x1,-0x30(%rbp)
L54:
  mov    -0x30(%rbp),%eax
  cmp    0x18(%rbp),%eax
  jle    L17
L7:
  movsd  -0x10(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

assistant: ```c
double calc_prob_dp(const double *matrix, int read_length, const char *seq, int seq_length, int pos, int *splice_pos, int *splice_offset, int n_splice, int gap_op, int gap_ex, int *seqnt_map) {
  int start = pos - (read_length / 2);
  int end = pos + (read_length / 2);
  int i, j;
  double probability = 0;
  if (n_splice == 0) {
    probability = calc_prob_region_dp(matrix, read_length, seq, seq_length, pos, start, end, gap_op, gap_ex, seqnt_map);
  } else {
    int r_pos = 0;
    int g_pos = pos;
    for (i = 0; i <= n_splice; i++) {
      int r_len = (i < n_splice) ? splice_pos[i] - r_pos + 1 : read_length - r_pos;
      int n = r_len / 2;
      start = g_pos - n;
      end = g_pos + n;
      double *submatrix = malloc(21 * r_len * sizeof(double));
      for (j = 0; j < 21; j++)
        memcpy(&submatrix[r_len * j], &matrix[read_length * j + r_pos], r_len * sizeof(double));
      probability += calc_prob_region_dp(submatrix, r_len, seq, seq_length, g_pos, start, end, gap_op, gap_ex, seqnt_map);
      free(submatrix);
      submatrix = NULL;
      g_pos += r_len + splice_offset[i];
      r_pos = splice_pos[i] + 1;
    }
  }
  return probability;
}
```