user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<calculateMinimumHP>:
  endbr64
  push   %r15
  movslq %esi,%rax
  push   %r14
  mov    %rdi,%r14
  lea    0x0(,%rax,8),%edi
  push   %r13
  push   %r12
  push   %rbp
  mov    %rax,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x28,%rsp
  mov    %edx,0xc(%rsp)
  mov    %rax,0x10(%rsp)
  call   <malloc@plt>
  mov    %rax,%r15
  movslq %ebx,%rax
  mov    %rax,0x18(%rsp)
  test   %ebp,%ebp
  jle    L33
  mov    0xc(%rsp),%eax
  mov    %r15,%rbx
  lea    0x0(,%rax,4),%r13d
  mov    %ebp,%eax
  lea    (%r15,%rax,8),%r12
  cs nopw 0x0(%rax,%rax,1)
L38:
  mov    %r13d,%edi
  add    $0x8,%rbx
  call   <malloc@plt>
  mov    %rax,-0x8(%rbx)
  cmp    %rbx,%r12
  jne    L38
L33:
  mov    0x10(%rsp),%rax
  mov    0x18(%rsp),%rcx
  mov    $0x1,%edx
  lea    -0x2(%rbp),%r9d
  movslq %r9d,%rbp
  shl    $0x3,%rax
  shl    $0x2,%rcx
  mov    -0x8(%r14,%rax,1),%rdi
  mov    -0x8(%r15,%rax,1),%r8
  mov    $0x1,%eax
  lea    -0x4(%rcx),%r10
  sub    -0x4(%rdi,%rcx,1),%eax
  test   %eax,%eax
  cmovle %edx,%eax
  mov    %rbp,%rdx
  mov    %eax,-0x4(%r8,%rcx,1)
  test   %r9d,%r9d
  js     L98
L54:
  mov    (%r14,%rdx,8),%r12
  mov    0x8(%r15,%rdx,8),%rax
  mov    (%r15,%rdx,8),%r11
  mov    (%rax,%r10,1),%eax
  sub    (%r12,%r10,1),%eax
  mov    $0x1,%r12d
  test   %eax,%eax
  cmovle %r12d,%eax
  sub    $0x1,%rdx
  mov    %eax,(%r11,%r10,1)
  test   %edx,%edx
  jns    L54
  mov    0xc(%rsp),%ebx
  sub    $0x2,%ebx
  js     L14
L5:
  movslq %ebx,%rdx
  nopl   0x0(%rax)
L113:
  mov    0x4(%r8,%rdx,4),%eax
  sub    (%rdi,%rdx,4),%eax
  mov    $0x1,%r10d
  test   %eax,%eax
  cmovle %r10d,%eax
  mov    %eax,(%r8,%rdx,4)
  sub    $0x1,%rdx
  test   %edx,%edx
  jns    L113
  test   %r9d,%r9d
  js     L57
  movslq %r9d,%rbp
  nopl   0x0(%rax,%rax,1)
L14:
  test   %ebx,%ebx
  js     L68
  mov    (%r15,%rbp,8),%r8
  mov    (%r14,%rbp,8),%r11
  movslq %ebx,%rdi
  mov    0x8(%r15,%rbp,8),%r10
  nopl   0x0(%rax)
L31:
  mov    0x4(%r8,%rdi,4),%eax
  sub    (%r11,%rdi,4),%eax
  mov    $0x1,%r9d
  mov    (%r10,%rdi,4),%edx
  sub    (%r11,%rdi,4),%edx
  test   %eax,%eax
  cmovle %r9d,%eax
  test   %edx,%edx
  cmovle %r9d,%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
  mov    %eax,(%r8,%rdi,4)
  sub    $0x1,%rdi
  test   %edi,%edi
  jns    L31
L68:
  sub    $0x1,%rbp
  test   %ebp,%ebp
  jns    L14
L57:
  mov    (%r15),%rax
  mov    (%rax),%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L98:
  mov    0xc(%rsp),%ebx
  sub    $0x2,%ebx
  jns    L5
  jmp    L57
```

assistant: ```c
int calculateMinimumHP(int **dungeon, int dungeonRowSize, int dungeonColSize) {
  int i, j;
  int **dp = malloc(dungeonRowSize * sizeof(int *));
  for (i = 0; i < dungeonRowSize; i++) {
    dp[i] = malloc(dungeonColSize * sizeof(int));
  }
  int hp = 1 - dungeon[dungeonRowSize - 1][dungeonColSize - 1];
  dp[dungeonRowSize - 1][dungeonColSize - 1] = hp >= 1 ? hp : 1;
  for (i = dungeonRowSize - 2; i >= 0; i--) {
    hp = dp[i + 1][dungeonColSize - 1] - dungeon[i][dungeonColSize - 1];
    dp[i][dungeonColSize - 1] = hp >= 1 ? hp : 1;
  }
  for (i = dungeonColSize - 2; i >= 0; i--) {
    hp = dp[dungeonRowSize - 1][i + 1] - dungeon[dungeonRowSize - 1][i];
    dp[dungeonRowSize - 1][i] = hp >= 1 ? hp : 1;
  }
  for (i = dungeonRowSize - 2; i >= 0; i--) {
    for (j = dungeonColSize - 2; j >= 0; j--) {
      int hp_r = dp[i][j + 1] - dungeon[i][j];
      int hp_d = dp[i + 1][j] - dungeon[i][j];
      hp_r = hp_r >= 1 ? hp_r : 1;
      hp_d = hp_d >= 1 ? hp_d : 1;
      dp[i][j] = hp_r < hp_d ? hp_r : hp_d;
    }
  }
  return dp[0][0];
}
```