user: Demonstrate the C code that generates the assembly output below:

```asm
<find_element>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movsd  %xmm0,-0x28(%rbp)
  mov    %rdi,-0x30(%rbp)
  mov    %rsi,-0x38(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x1,-0x10(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm1
  mov    -0x30(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd %xmm1,%xmm0
  jbe    L101
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm0
  comisd -0x28(%rbp),%xmm0
  ja     L213
  mov    -0x30(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x28(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jbe    L64
L213:
  mov    -0x30(%rbp),%rax
  jmp    L203
L64:
  movq   $0x1,-0x20(%rbp)
  jmp    L99
L212:
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  sar    %rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x28(%rbp),%xmm0
  seta   %al
  xor    $0x1,%eax
  test   %al,%al
  je     L169
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x28(%rbp),%xmm0
  comisd %xmm1,%xmm0
  seta   %al
  xor    $0x1,%eax
  test   %al,%al
  jne    L140
L169:
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x28(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jbe    L121
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L0
L121:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L0:
  addq   $0x1,-0x20(%rbp)
L99:
  mov    -0x20(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  jl     L212
  jmp    L27
L101:
  mov    -0x30(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x28(%rbp),%xmm0
  ja     L186
  mov    -0x38(%rbp),%rax
  movsd  (%rax),%xmm1
  movsd  -0x28(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jbe    L156
L186:
  mov    -0x30(%rbp),%rax
  jmp    L203
L156:
  movq   $0x1,-0x20(%rbp)
  jmp    L93
L133:
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  sar    %rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x28(%rbp),%xmm0
  seta   %al
  xor    $0x1,%eax
  test   %al,%al
  je     L187
  mov    -0x18(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x28(%rbp),%xmm0
  comisd %xmm1,%xmm0
  seta   %al
  xor    $0x1,%eax
  test   %al,%al
  jne    L220
L187:
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x28(%rbp),%xmm0
  jbe    L66
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L214
L66:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L214:
  addq   $0x1,-0x20(%rbp)
L93:
  mov    -0x20(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  jl     L133
  jmp    L27
L140:
  nop
  jmp    L27
L220:
  nop
L27:
  cmpq   $0x1,-0x18(%rbp)
  jle    L50
  mov    -0x18(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x28(%rbp),%xmm0
  seta   %al
  xor    $0x1,%eax
  test   %al,%al
  je     L50
  mov    -0x18(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x28(%rbp),%xmm0
  comisd %xmm1,%xmm0
  seta   %al
  xor    $0x1,%eax
  test   %al,%al
  je     L50
  subq   $0x1,-0x18(%rbp)
L50:
  mov    -0x18(%rbp),%rax
L203:
  pop    %rbp
  ret
```

assistant: ```c
long find_element(double x, long nelem, const double *restrict array) {
  long ii;
  long mid = 0;
  long first = 1;
  long last = nelem;
  if (array[0] < array[nelem - 1]) {
    if (x < array[0] || x > array[nelem - 1])
      return (nelem);
    for (ii = 1; ii < nelem; ++ii) {
      mid = (first + last) >> 1;
      if (!(x < array[mid - 1] || x > array[mid]))
        break;
      if (x > array[mid])
        first = mid;
      else
        last = mid;
    }
  } else {
    if (x < array[nelem - 1] || x > array[0])
      return (nelem);
    for (ii = 1; ii < nelem; ++ii) {
      mid = (first + last) >> 1;
      if (!(x < array[mid] || x > array[mid - 1]))
        break;
      if (x < array[mid])
        first = mid;
      else
        last = mid;
    }
  }
  if (mid > 1 && (!(x < array[mid - 1] || array[mid - 1] < x)))
    mid--;
  return (mid);
}
```