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

```asm
<trap_water>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jg     L55
  mov    -0x1c(%rbp),%eax
  jmp    L32
L55:
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x1,-0x18(%rbp)
  jmp    L7
L51:
  mov    -0x18(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  mov    -0x18(%rbp),%ecx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,4),%rsi
  mov    -0x10(%rbp),%rcx
  add    %rsi,%rcx
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,(%rcx)
  addl   $0x1,-0x18(%rbp)
L7:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L51
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x14(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  lea    -0x4(%rdx),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x14(%rbp),%eax
  sub    $0x2,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L13
L6:
  mov    -0x18(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  mov    -0x18(%rbp),%ecx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,4),%rsi
  mov    -0x8(%rbp),%rcx
  add    %rsi,%rcx
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,(%rcx)
  subl   $0x1,-0x18(%rbp)
L13:
  cmpl   $0x0,-0x18(%rbp)
  jns    L6
  movl   $0x0,-0x18(%rbp)
  jmp    L35
L50:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  add    %eax,-0x1c(%rbp)
  addl   $0x1,-0x18(%rbp)
L35:
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L50
  mov    -0x1c(%rbp),%eax
L32:
  leave
  ret
```

assistant: ```c
int trap_water(int *height, int height_size) {
  int *max_left, *max_right;
  int water = 0, i, n = height_size;
  if (n < 1) {
    return water;
  }
  max_left = (int *)malloc(sizeof(int) * n);
  max_right = (int *)malloc(sizeof(int) * n);
  max_left[0] = height[0];
  for (i = 1; i < n; ++i) {
    max_left[i] = (((max_left[i - 1]) < (height[i])) ? (height[i]) : (max_left[i - 1]));
  }
  max_right[n - 1] = height[n - 1];
  for (i = n - 2; i >= 0; --i) {
    max_right[i] = (((max_right[i + 1]) < (height[i])) ? (height[i]) : (max_right[i + 1]));
  }
  for (i = 0; i < n; ++i) {
    water += (((max_left[i]) > (max_right[i])) ? (max_right[i]) : (max_left[i])) - height[i];
  }
  return water;
}
```