user: Please show me the C implementation that matches the assembly code listed below:

```asm
<max_area_2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %ecx,-0x34(%rbp)
  mov    -0x30(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jne    L25
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  jmp    L114
L25:
  mov    -0x30(%rbp),%edx
  mov    -0x34(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%ecx
  mov    -0x30(%rbp),%edx
  mov    -0x2c(%rbp),%esi
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <max_area_2>
  mov    %eax,-0x1c(%rbp)
  mov    -0xc(%rbp),%eax
  lea    0x1(%rax),%edi
  mov    -0x34(%rbp),%edx
  mov    -0x2c(%rbp),%esi
  mov    -0x28(%rbp),%rax
  mov    %edx,%ecx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <max_area_2>
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L131
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
L131:
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  add    %eax,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L64
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L64
L8:
  mov    -0x14(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jge    L76
  mov    -0x18(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  je     L109
  mov    -0x18(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x14(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L76
L109:
  addl   $0x1,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x10(%rbp)
  jle    L129
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  jmp    L129
L76:
  subl   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x10(%rbp)
  jle    L129
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
L129:
  mov    -0x14(%rbp),%eax
  sub    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x10(%rbp),%eax
  imul   %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L64
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
L64:
  mov    -0x18(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jg     L8
  mov    -0x14(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L8
  mov    -0x1c(%rbp),%eax
L114:
  leave
  ret
```

assistant: ```c
int max_area_2(int *heights, int size, int from, int to) {
  if (from == to) {
    return heights[from];
  }
  int mid = (from + to) / 2;
  int max = max_area_2(heights, size, from, mid);
  int max_right = max_area_2(heights, size, mid + 1, to);
  if (max_right > max) {
    max = max_right;
  }
  int left = mid, right = mid + 1;
  int minHeight = heights[right] < heights[left] ? heights[right] : heights[left];
  int candidate = minHeight * 2;
  if (candidate > max) {
    max = candidate;
  }
  while (left > from || right < to) {
    if (right < to && (left == from || heights[left - 1] < heights[right + 1])) {
      right++;
      if (heights[right] < minHeight) {
        minHeight = heights[right];
      }
    } else {
      left--;
      if (heights[left] < minHeight) {
        minHeight = heights[left];
      }
    }
    candidate = minHeight * (right - left + 1);
    if (candidate > max) {
      max = candidate;
    }
  }
  return max;
}
```