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

```asm
<calculateMinimumHP>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L8
L10:
  mov    -0x40(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x18(%rbp),%rax
  lea    (%rcx,%rax,1),%rbx
  mov    %edx,%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  addl   $0x1,-0x2c(%rbp)
L8:
  mov    -0x2c(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L10
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%eax
  cltq
  shl    $0x2,%rax
  sub    $0x4,%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    $0x1,%eax
  sub    %edx,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%eax
  cltq
  shl    $0x2,%rax
  sub    $0x4,%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  mov    $0x1,%ecx
  test   %eax,%eax
  cmovle %ecx,%eax
  mov    %eax,(%rdx)
  mov    -0x3c(%rbp),%eax
  sub    $0x2,%eax
  mov    %eax,-0x2c(%rbp)
  jmp    L84
L91:
  mov    -0x2c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%eax
  cltq
  shl    $0x2,%rax
  sub    $0x4,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x40(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  sub    $0x4,%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%eax
  cltq
  shl    $0x2,%rax
  sub    $0x4,%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  mov    $0x1,%ecx
  test   %eax,%eax
  cmovle %ecx,%eax
  mov    %eax,(%rdx)
  subl   $0x1,-0x2c(%rbp)
L84:
  cmpl   $0x0,-0x2c(%rbp)
  jns    L91
  mov    -0x40(%rbp),%eax
  sub    $0x2,%eax
  mov    %eax,-0x2c(%rbp)
  jmp    L40
L42:
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  add    $0x1,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x3c(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  lea    -0x8(%rdx),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  mov    $0x1,%ecx
  test   %eax,%eax
  cmovle %ecx,%eax
  mov    %eax,(%rdx)
  subl   $0x1,-0x2c(%rbp)
L40:
  cmpl   $0x0,-0x2c(%rbp)
  jns    L42
  mov    -0x3c(%rbp),%eax
  sub    $0x2,%eax
  mov    %eax,-0x2c(%rbp)
  jmp    L5
L58:
  mov    -0x40(%rbp),%eax
  sub    $0x2,%eax
  mov    %eax,-0x28(%rbp)
  jmp    L64
L69:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%eax
  cltq
  add    $0x1,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x28(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x28(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x20(%rbp),%eax
  mov    $0x1,%edx
  test   %eax,%eax
  cmovle %edx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    $0x1,%edx
  test   %eax,%eax
  cmovle %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,(%rcx)
  subl   $0x1,-0x28(%rbp)
L64:
  cmpl   $0x0,-0x28(%rbp)
  jns    L69
  subl   $0x1,-0x2c(%rbp)
L5:
  cmpl   $0x0,-0x2c(%rbp)
  jns    L58
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%eax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

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];
}
```