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

```asm
<main>:
  endbr64
  push   %r15
  lea    D17(%rip),%r15
  push   %r14
  lea    D13(%rip),%r14
  push   %r13
  lea    D24(%rip),%r13
  push   %r12
  push   %rbp
  lea    D64(%rip),%rbp
  push   %rbx
  lea    D43(%rip),%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  nopl   0x0(%rax,%rax,1)
L20:
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    (%rsp),%eax
  cmp    $0x8,%eax
  je     L10
  cmp    $0x7,%eax
  ja     L20
  movslq (%rbx,%rax,4),%rax
  add    %rbx,%rax
  notrack jmp *%rax
  xor    %eax,%eax
  call   <display@plt>
  jmp    L20
  nopl   0x0(%rax)
  xor    %eax,%eax
  call   <reverse@plt>
  xor    %eax,%eax
  call   <display@plt>
  jmp    L20
  mov    %r14,%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  lea    0x4(%rsp),%rsi
  call   <scanf@plt>
  mov    0x4(%rsp),%edi
  call   <search@plt>
  cmp    $0x1,%eax
  je     L58
  mov    %r15,%rdi
  call   <puts@plt>
  jmp    L20
  nopl   0x0(%rax)
  xor    %eax,%eax
  call   <count@plt>
  lea    D3(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L20
  nopl   0x0(%rax)
  lea    D47(%rip),%rdi
  call   <puts@plt>
  lea    0x4(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%edi
  call   <deleteele@plt>
  xor    %eax,%eax
  call   <display@plt>
  jmp    L20
  cs nopw 0x0(%rax,%rax,1)
  lea    D76(%rip),%rdi
  call   <puts@plt>
  lea    0x4(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%edi
  call   <insertend@plt>
  xor    %eax,%eax
  call   <display@plt>
  jmp    L20
  xchg   %ax,%ax
  lea    D76(%rip),%rdi
  call   <puts@plt>
  lea    0x4(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%edi
  call   <insertbeg@plt>
  xor    %eax,%eax
  call   <display@plt>
  jmp    L20
  xchg   %ax,%ax
L58:
  lea    D8(%rip),%rdi
  call   <puts@plt>
  jmp    L20
  nopl   0x0(%rax)
L10:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L47
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L47:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D17
datatype: string
name: unpack_data
arguments: data_tag: D13
datatype: string
name: unpack_data
arguments: data_tag: D24
datatype: string
name: unpack_data
arguments: data_tag: D64
datatype: string
name: unpack_data
arguments: data_tag: D3
datatype: string
name: unpack_data
arguments: data_tag: D47
datatype: string
name: unpack_data
arguments: data_tag: D76
datatype: string
name: unpack_data
arguments: data_tag: D8
datatype: string

tool: D17: Element not found

tool: D13: Enter element to be searched

tool: D24: Enter choice: 1. Insertbeg 2. Insertend 3. Delete ele 4. Count 5. Search 6. Reverse 7. Display 8. Exit - 

tool: D64: %d

tool: D3: Count = %d

tool: D47: Enter element to be deleted

tool: D76: Enter element to be inserted

tool: D8: Element found

assistant: ```c
void main() {
  int ch, ele, z;
  while (1) {
    printf("Enter choice: 1. Insertbeg 2. Insertend 3. Delete ele 4. Count 5. Search 6. Reverse 7. Display 8. Exit - ");
    scanf("%d", &ch);
    if (ch == 8)
      break;
    switch (ch) {
    case 1:
      printf("Enter element to be inserted\n");
      scanf("%d", &ele);
      insertbeg(ele);
      display();
      break;
    case 2:
      printf("Enter element to be inserted\n");
      scanf("%d", &ele);
      insertend(ele);
      display();
      break;
    case 3:
      printf("Enter element to be deleted\n");
      scanf("%d", &ele);
      deleteele(ele);
      display();
      break;
    case 4:
      z = count();
      printf("Count = %d", z);
      break;
    case 5:
      printf("Enter element to be searched\n");
      scanf("%d", &ele);
      z = search(ele);
      if (z == 1)
        printf("Element found\n");
      else
        printf("Element not found\n");
      break;
    case 6:
      reverse();
      display();
      break;
    case 7:
      display();
      break;
    }
  }
}
```