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

```asm
<main>:
  endbr64
  push   %r12
  lea    D44(%rip),%rdi
  push   %rbp
  lea    D21(%rip),%rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  call   <puts@plt>
  lea    0x8(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  lea    D30(%rip),%rdi
  call   <puts@plt>
  mov    0x8(%rsp),%edx
  mov    %rbp,%rdi
  test   %edx,%edx
  lea    0x1(%rdx),%eax
  mov    $0x0,%edx
  cmovs  %edx,%eax
  cltq
  lea    0x10(%rsp,%rax,4),%rsi
  call   <scanf@plt>
  lea    D27(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    0xc(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x8(%rsp),%eax
  sub    $0x1,%eax
  js     L27
  mov    0xc(%rsp),%ecx
  xor    %edx,%edx
  jmp    L8
  nopl   0x0(%rax)
L101:
  lea    -0x1(%rbx),%eax
L40:
  cmp    %edx,%eax
  jl     L27
L8:
  lea    (%rax,%rdx,1),%ebx
  sar    %ebx
  movslq %ebx,%rbp
  cmp    %ecx,0x10(%rsp,%rbp,4)
  je     L47
  jg     L101
  lea    (%rbx,%rbx,1),%ebp
  movslq %ebp,%r12
  mov    0x10(%rsp,%r12,4),%esi
  cmp    %esi,%ecx
  je     L4
  lea    0x1(%rbp),%edx
  jge    L40
  lea    0x1(%rbx),%edx
  lea    -0x1(%rbp),%eax
  cmp    %edx,%eax
  jge    L8
  nopl   (%rax)
L27:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L78
  add    $0x40,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L47:
  lea    D69(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x10(%rsp,%rbp,4),%edx
  lea    0x1(%rbx),%esi
  xor    %eax,%eax
  lea    D1(%rip),%rdi
  call   <printf@plt>
  jmp    L27
L4:
  lea    D69(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x10(%rsp,%r12,4),%edx
  lea    0x1(%rbp),%esi
  xor    %eax,%eax
  lea    D1(%rip),%rdi
  call   <printf@plt>
  jmp    L27
L78:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D44
data_type: string
name: parse_data
arguments: label: D21
data_type: string
name: parse_data
arguments: label: D30
data_type: string
name: parse_data
arguments: label: D27
data_type: string
name: parse_data
arguments: label: D69
data_type: string
name: parse_data
arguments: label: D1
data_type: string

tool: D44: Enter the length of a array::

tool: D21: %d

tool: D30: Enter the elements in sorted order

tool: D27: 
Enter a element to search in the array::	

tool: D69: 
Element present in the array

tool: D1: 
position is %d

value is %d


assistant: ```c
int main() {
  int a[10], temp, i, j, n, x, p, mid1, mid2, low, high;
  printf("Enter the length of a array::\n");
  scanf("%d", &n);
  printf("Enter the elements in sorted order\n");
  for (i = 0; i <= n; i++)
    ;
  scanf("%d", &a[i]);
  printf("\nEnter a element to search in the array::\t");
  scanf("%d", &x);
  low = 0;
  high = n - 1;
  while (low <= high) {
    mid1 = (low + high) / 2;
    mid2 = 2 * mid1;
    if (x == a[mid1]) {
      printf("\nElement present in the array");
      printf("\nposition is %d\n\nvalue is %d\n", mid1 + 1, a[mid1]);
      break;
    } else if (x < a[mid1])
      high = mid1 - 1;
    else if (x == a[mid2]) {
      printf("\nElement present in the array");
      printf("\nposition is %d\n\nvalue is %d\n", mid2 + 1, a[mid2]);
      break;
    } else if (x < a[mid2]) {
      low = mid1 + 1;
      high = mid2 - 1;
    } else
      low = mid2 + 1;
  }
  return 0;
}
```