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

```asm
<longest_bitonic_sequence>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x98,%rsp
  mov    %rdi,-0x98(%rbp)
  mov    %esi,-0x9c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0x9c(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x68(%rbp)
  movslq %edx,%rax
  mov    %rax,-0xb0(%rbp)
  movq   $0x0,-0xa8(%rbp)
  movslq %edx,%rax
  mov    %rax,-0xc0(%rbp)
  movq   $0x0,-0xb8(%rbp)
  movslq %edx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L157:
  cmp    %rdx,%rsp
  je     L124
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L157
L124:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L83
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L83:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x60(%rbp)
  mov    -0x9c(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x58(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L90:
  cmp    %rdx,%rsp
  je     L12
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L90
L12:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L37
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L37:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x50(%rbp)
  mov    -0x9c(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L104:
  cmp    %rdx,%rsp
  je     L139
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L104
L139:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L158
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L158:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x98(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x1,-0x84(%rbp)
  mov    -0x60(%rbp),%rax
  movl   $0x1,(%rax)
  movl   $0x1,-0x80(%rbp)
  jmp    L4
L63:
  mov    -0x80(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x84(%rbp),%ecx
  mov    -0x40(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <lower_bound@plt>
  mov    %eax,-0x6c(%rbp)
  mov    -0x6c(%rbp),%eax
  cmp    -0x84(%rbp),%eax
  jne    L117
  mov    -0x80(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x98(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x84(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x84(%rbp)
  mov    (%rcx),%ecx
  mov    -0x40(%rbp),%rdx
  cltq
  mov    %ecx,(%rdx,%rax,4)
  jmp    L6
L117:
  mov    -0x80(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x40(%rbp),%rax
  mov    -0x6c(%rbp),%edx
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
L6:
  mov    -0x60(%rbp),%rax
  mov    -0x80(%rbp),%edx
  movslq %edx,%rdx
  mov    -0x84(%rbp),%ecx
  mov    %ecx,(%rax,%rdx,4)
  addl   $0x1,-0x80(%rbp)
L4:
  mov    -0x80(%rbp),%eax
  cmp    -0x9c(%rbp),%eax
  jl     L63
  movl   $0x1,-0x84(%rbp)
  mov    -0x9c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x50(%rbp),%rax
  movslq %edx,%rdx
  movl   $0x1,(%rax,%rdx,4)
  mov    -0x9c(%rbp),%eax
  sub    $0x2,%eax
  mov    %eax,-0x7c(%rbp)
  jmp    L105
L59:
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x84(%rbp),%ecx
  mov    -0x40(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <lower_bound@plt>
  mov    %eax,-0x70(%rbp)
  mov    -0x70(%rbp),%eax
  cmp    -0x84(%rbp),%eax
  jne    L9
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x98(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x84(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x84(%rbp)
  mov    (%rcx),%ecx
  mov    -0x40(%rbp),%rdx
  cltq
  mov    %ecx,(%rdx,%rax,4)
  jmp    L61
L9:
  mov    -0x7c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x98(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x40(%rbp),%rax
  mov    -0x70(%rbp),%edx
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
L61:
  mov    -0x50(%rbp),%rax
  mov    -0x7c(%rbp),%edx
  movslq %edx,%rdx
  mov    -0x84(%rbp),%ecx
  mov    %ecx,(%rax,%rdx,4)
  subl   $0x1,-0x7c(%rbp)
L105:
  cmpl   $0x0,-0x7c(%rbp)
  jns    L59
  movl   $0x0,-0x78(%rbp)
  movl   $0x0,-0x74(%rbp)
  jmp    L122
L195:
  mov    -0x60(%rbp),%rax
  mov    -0x74(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%ecx
  mov    -0x50(%rbp),%rax
  mov    -0x74(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  add    %ecx,%eax
  lea    -0x1(%rax),%edx
  mov    -0x78(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <max@plt>
  mov    %eax,-0x78(%rbp)
  addl   $0x1,-0x74(%rbp)
L122:
  mov    -0x74(%rbp),%eax
  cmp    -0x9c(%rbp),%eax
  jl     L195
  mov    -0x78(%rbp),%eax
  mov    %rbx,%rsp
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L20
  call   <__stack_chk_fail@plt>
L20:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
int longest_bitonic_sequence(int v[], int n) {
  int lis[n];
  int lds[n];
  int tail[n], tailSize;
  int i;
  tail[0] = v[0];
  tailSize = 1;
  lis[0] = 1;
  for (i = 1; i < n; ++i) {
    int idx = lower_bound(tail, tailSize, v[i]);
    if (idx == tailSize)
      tail[tailSize++] = v[i];
    else
      tail[idx] = v[i];
    lis[i] = tailSize;
  }
  tailSize = 1;
  lds[n - 1] = 1;
  for (int i = n - 2; i >= 0; --i) {
    int idx = lower_bound(tail, tailSize, v[i]);
    if (idx == tailSize)
      tail[tailSize++] = v[i];
    else
      tail[idx] = v[i];
    lds[i] = tailSize;
  }
  int ans = 0;
  for (int i = 0; i < n; ++i)
    ans = max(ans, lis[i] + lds[i] - 1);
  return ans;
}
```