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

```asm
<calculateMinimumHP>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  je     L11
  mov    %edx,%r13d
  test   %edx,%edx
  je     L11
  mov    %rdi,%rbx
  lea    0x0(,%rdx,4),%edi
  mov    %esi,%r12d
  call   <malloc@plt>
  movslq %r13d,%rsi
  mov    $0x1,%edx
  mov    %r13d,%r10d
  mov    %rax,%r11
  movslq %r12d,%rax
  shl    $0x2,%rsi
  mov    -0x8(%rbx,%rax,8),%r8
  mov    %edx,%eax
  lea    -0x4(%rsi),%rbp
  lea    (%r11,%rbp,1),%r9
  mov    -0x4(%r8,%rsi,1),%ecx
  sub    %ecx,%eax
  test   %ecx,%ecx
  cmovg  %edx,%eax
  mov    %eax,(%r9)
  sub    $0x2,%r10d
  js     L28
  movslq %r10d,%rax
  mov    %r10d,%ecx
  sub    %r11,%r8
  shl    $0x2,%rax
  shl    $0x2,%rcx
  lea    (%r11,%rax,1),%rdx
  sub    $0x4,%rax
  sub    %rcx,%rax
  lea    (%rax,%r11,1),%rcx
  nopl   0x0(%rax)
L6:
  mov    0x4(%rdx),%eax
  sub    (%r8,%rdx,1),%eax
  mov    $0x1,%edi
  test   %eax,%eax
  cmovle %edi,%eax
  sub    $0x4,%rdx
  mov    %eax,0x4(%rdx)
  cmp    %rdx,%rcx
  jne    L6
L28:
  sub    $0x2,%r12d
  js     L18
  movslq %r10d,%rax
  movslq %r12d,%r8
  sub    $0xc,%rsi
  lea    (%r11,%rax,4),%r12
  mov    %r10d,%eax
  shl    $0x2,%rax
  sub    %rax,%rsi
  lea    (%rsi,%r11,1),%rdi
  nop
L8:
  mov    (%rbx,%r8,8),%rsi
  mov    $0x1,%edx
  mov    (%rsi,%rbp,1),%eax
  sub    %eax,(%r9)
  mov    (%r9),%eax
  test   %eax,%eax
  cmovle %edx,%eax
  mov    %eax,(%r9)
  test   %r10d,%r10d
  js     L38
  mov    %r12,%rdx
  sub    %r11,%rsi
  nopl   (%rax)
L71:
  mov    (%rdx),%ecx
  mov    0x4(%rdx),%eax
  cmp    %ecx,%eax
  cmovg  %ecx,%eax
  sub    (%rsi,%rdx,1),%eax
  mov    $0x1,%ecx
  test   %eax,%eax
  cmovle %ecx,%eax
  sub    $0x4,%rdx
  mov    %eax,0x4(%rdx)
  cmp    %rdi,%rdx
  jne    L71
L38:
  sub    $0x1,%r8
  test   %r8d,%r8d
  jns    L8
L18:
  mov    (%r11),%r12d
  mov    %r11,%rdi
  call   <free@plt>
  add    $0x8,%rsp
  pop    %rbx
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L11:
  add    $0x8,%rsp
  xor    %r12d,%r12d
  pop    %rbx
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int calculateMinimumHP(int **dungeon, int dungeonRowSize, int dungeonColSize) {
  int ret, *dp, i, j, *curr;
  if (!(dungeonRowSize && dungeonColSize))
    return 0;
  dp = (int *)malloc(dungeonColSize * sizeof(int));
  dp[dungeonColSize - 1] = ((1) > (1 - dungeon[dungeonRowSize - 1][dungeonColSize - 1]) ? (1) : (1 - dungeon[dungeonRowSize - 1][dungeonColSize - 1]));
  for (j = dungeonColSize - 2; j >= 0; --j)
    dp[j] = ((1) > (dp[j + 1] - dungeon[dungeonRowSize - 1][j]) ? (1) : (dp[j + 1] - dungeon[dungeonRowSize - 1][j]));
  for (i = dungeonRowSize - 2; i >= 0; --i) {
    curr = dungeon[i];
    dp[dungeonColSize - 1] = ((1) > (dp[dungeonColSize - 1] - curr[dungeonColSize - 1]) ? (1) : (dp[dungeonColSize - 1] - curr[dungeonColSize - 1]));
    for (j = dungeonColSize - 2; j >= 0; --j)
      dp[j] = ((1) > (((dp[j]) < (dp[j + 1]) ? (dp[j]) : (dp[j + 1])) - curr[j]) ? (1) : (((dp[j]) < (dp[j + 1]) ? (dp[j]) : (dp[j + 1])) - curr[j]));
  }
  ret = dp[0];
  free(dp);
  return ret;
}
```