user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<findPeakElement>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L74
  cmpl   $0x0,-0x1c(%rbp)
  jne    L168
L74:
  mov    $0xffffffff,%eax
  jmp    L51
L168:
  cmpl   $0x1,-0x1c(%rbp)
  jne    L178
  mov    $0x0,%eax
  jmp    L51
L178:
  cmpl   $0x2,-0x1c(%rbp)
  jne    L174
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  setle  %al
  movzbl %al,%eax
  jmp    L51
L174:
  movl   $0x0,-0xc(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L24
L107:
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jne    L97
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L97
  mov    $0x0,%eax
  jmp    L51
L97:
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x4(%rbp)
  jne    L207
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x8(%rax),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L207
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  jmp    L51
L207:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L1
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L1
  mov    -0x4(%rbp),%eax
  jmp    L51
L1:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L147
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L24
L147:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L24
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  nop
L24:
  mov    -0xc(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jle    L107
  mov    $0xffffffff,%eax
L51:
  pop    %rbp
  ret
```

assistant: ```c
int findPeakElement(int num[], int n) {
  if (!num || !n)
    return (-1);
  if (n == 1)
    return (0);
  if (n == 2)
    return (num[0] > num[1] ? 0 : 1);
  int m, l, h;
  l = 0;
  h = n - 1;
  while (l <= h) {
    m = (l + h) / 2;
    if (m == 0 && num[0] > num[1])
      return (0);
    if (m == (n - 1) && num[n - 1] > num[n - 2])
      return (n - 1);
    if (num[m] > num[m + 1] && num[m] > num[m - 1])
      return (m);
    if (num[m] < num[m + 1]) {
      l = m + 1;
      continue;
    }
    if (num[m] < num[m - 1]) {
      h = m - 1;
      continue;
    }
  }
  return (-1);
}
```