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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1c0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x1b8(%rbp),%rax
  mov    %rax,%rsi
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  lea    D77(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x0,-0x1b0(%rbp)
  jmp    L97
L23:
  lea    -0x1a0(%rbp),%rdx
  mov    -0x1b0(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  addl   $0x1,-0x1b0(%rbp)
L97:
  mov    -0x1b8(%rbp),%eax
  cmp    %eax,-0x1b0(%rbp)
  jle    L23
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x0,-0x1b0(%rbp)
  jmp    L4
L68:
  mov    -0x1b0(%rbp),%eax
  cltq
  mov    -0x1a0(%rbp,%rax,4),%eax
  mov    %eax,%esi
  lea    D65(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x1b0(%rbp)
L4:
  mov    -0x1b8(%rbp),%eax
  cmp    %eax,-0x1b0(%rbp)
  jle    L68
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x1b4(%rbp),%rax
  mov    %rax,%rsi
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  movl   $0x0,-0x1a8(%rbp)
  mov    -0x1b8(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x1ac(%rbp)
  jmp    L42
L104:
  mov    -0x1ac(%rbp),%edx
  mov    -0x1a8(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x1a4(%rbp)
  mov    -0x1a4(%rbp),%eax
  cltq
  mov    -0x1a0(%rbp,%rax,4),%edx
  mov    -0x1b4(%rbp),%eax
  cmp    %eax,%edx
  jge    L17
  mov    -0x1a4(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x1a8(%rbp)
  jmp    L42
L17:
  mov    -0x1a4(%rbp),%eax
  cltq
  mov    -0x1a0(%rbp,%rax,4),%edx
  mov    -0x1b4(%rbp),%eax
  cmp    %eax,%edx
  jne    L105
  mov    -0x1a4(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x1b4(%rbp),%eax
  mov    %eax,%esi
  lea    D90(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L22
L105:
  mov    -0x1a4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x1ac(%rbp)
  mov    -0x1a8(%rbp),%edx
  mov    -0x1ac(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x1a4(%rbp)
L42:
  mov    -0x1a8(%rbp),%eax
  cmp    -0x1ac(%rbp),%eax
  jle    L104
L22:
  mov    -0x1a8(%rbp),%eax
  cmp    -0x1ac(%rbp),%eax
  jle    L100
  mov    -0x1b4(%rbp),%eax
  mov    %eax,%esi
  lea    D41(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L100:
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D10
type_guessed: string
name: unpack_data
arguments: label: D61
type_guessed: string
name: unpack_data
arguments: label: D77
type_guessed: string
name: unpack_data
arguments: label: D25
type_guessed: string
name: unpack_data
arguments: label: D65
type_guessed: string
name: unpack_data
arguments: label: D12
type_guessed: string
name: unpack_data
arguments: label: D90
type_guessed: string
name: unpack_data
arguments: label: D41
type_guessed: string

tool: D10: Please enter the number of elements 

tool: D61: %d

tool: D77: Please enter the array

tool: D25: The entered array is

tool: D65: %d 


tool: D12: Please enter the value to be searched

tool: D90: searched element found at location %d %d 


tool: D41: oops!!! %d searched element not found


assistant: ```c
int main() {
  int i, last, first, middle, n, search, array[100];
  printf("Please enter the number of elements \n");
  scanf("%d", &n);
  printf("Please enter the array\n");
  for (i = 0; i <= n; i++) {
    scanf("%d", &array[i]);
  }
  printf("The entered array is\n");
  for (i = 0; i <= n; i++) {
    printf("%d \n", array[i]);
  }
  printf("Please enter the value to be searched\n");
  scanf("%d", &search);
  first = 0;
  last = n - 1;
  while (first <= last) {
    middle = (last + first) / 2;
    if (array[middle] < search)
      first = middle + 1;
    else if (array[middle] == search) {
      printf("searched element found at location %d %d \n", search, middle + 1);
      break;
    } else {
      last = middle - 1;
      middle = (first + last) / 2;
    }
  }
  if (first > last) {
    printf("oops!!! %d searched element not found\n", search);
  }
}
```