user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D15(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x34(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  lea    D201(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x0,-0x20(%rbp)
  jmp    L76
L197:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  addl   $0x1,-0x20(%rbp)
L76:
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x20(%rbp)
  jl     L197
  mov    $0x0,%eax
  call   <mainchoices@plt>
  lea    -0x30(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  jmp    L320
L276:
  mov    -0x30(%rbp),%eax
  cmp    $0x1,%eax
  jne    L53
  mov    $0x0,%eax
  call   <changechoices@plt>
  lea    -0x2c(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x2c(%rbp),%eax
  cmp    $0x1,%eax
  jne    L44
  lea    D198(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x28(%rbp),%edx
  mov    -0x34(%rbp),%eax
  cmp    %eax,%edx
  jge    L175
  mov    -0x28(%rbp),%eax
  test   %eax,%eax
  js     L175
  lea    D301(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x24(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x24(%rbp),%edx
  mov    -0x28(%rbp),%ecx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <updateByIndex@plt>
  mov    -0x24(%rbp),%edx
  mov    -0x28(%rbp),%eax
  mov    %eax,%esi
  lea    D260(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L215
L175:
  mov    -0x34(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%esi
  lea    D167(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <mainchoices@plt>
  jmp    L215
L44:
  mov    -0x2c(%rbp),%eax
  cmp    $0x2,%eax
  jne    L311
  lea    D67(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x24(%rbp),%rdx
  lea    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x34(%rbp),%edx
  mov    -0x28(%rbp),%ecx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <search@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x14(%rbp)
  jge    L170
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x24(%rbp),%edx
  mov    -0x14(%rbp),%eax
  mov    %eax,%esi
  lea    D89(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L215
L170:
  lea    D99(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <mainchoices@plt>
  jmp    L215
L311:
  lea    D213(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <mainchoices@plt>
  jmp    L215
L53:
  mov    -0x30(%rbp),%eax
  cmp    $0x2,%eax
  jne    L145
  mov    $0x0,%eax
  call   <deletechoices@plt>
  lea    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x28(%rbp),%eax
  cmp    $0x1,%eax
  jne    L41
  lea    D134(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x24(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x24(%rbp),%edx
  mov    -0x34(%rbp),%eax
  cmp    %eax,%edx
  jge    L59
  mov    -0x34(%rbp),%edx
  mov    -0x24(%rbp),%ecx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <deleteindex@plt>
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  lea    D128(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L215
L59:
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  lea    D187(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <mainchoices@plt>
  jmp    L215
L41:
  mov    -0x28(%rbp),%eax
  cmp    $0x2,%eax
  jne    L215
  lea    D282(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x24(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x34(%rbp),%edx
  mov    -0x24(%rbp),%ecx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <search@plt>
  mov    %eax,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x18(%rbp)
  jge    L211
  mov    -0x34(%rbp),%edx
  mov    -0x18(%rbp),%ecx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <deleteindex@plt>
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  lea    D253(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L215
L211:
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  lea    D297(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L215
L145:
  mov    -0x30(%rbp),%eax
  cmp    $0x3,%eax
  jne    L325
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x24(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
  mov    -0x34(%rbp),%edx
  mov    -0x24(%rbp),%ecx
  mov    -0x10(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <search@plt>
  mov    %eax,-0x1c(%rbp)
  mov    -0x34(%rbp),%eax
  cmp    %eax,-0x1c(%rbp)
  jge    L80
  mov    -0x24(%rbp),%eax
  mov    -0x1c(%rbp),%edx
  mov    %eax,%esi
  lea    D141(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L215
L80:
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  lea    D40(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L215
L325:
  mov    -0x30(%rbp),%eax
  cmp    $0x4,%eax
  jne    L243
  mov    -0x34(%rbp),%edx
  mov    -0x10(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <printfun@plt>
  jmp    L215
L243:
  mov    -0x30(%rbp),%eax
  cmp    $0x5,%eax
  jne    L198
  mov    -0x34(%rbp),%eax
  mov    %eax,%esi
  lea    D173(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L215
L198:
  lea    D123(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <mainchoices@plt>
L215:
  mov    $0x0,%eax
  call   <mainchoices@plt>
  lea    -0x30(%rbp),%rax
  mov    %rax,%rsi
  lea    D250(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <scanf@plt>
L320:
  mov    -0x30(%rbp),%eax
  cmp    $0xffffffff,%eax
  jne    L276
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L285
  call   <__stack_chk_fail@plt>
L285:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D15
type_infered: string
name: disassemble_data
arguments: label: D250
type_infered: string
name: disassemble_data
arguments: label: D201
type_infered: string
name: disassemble_data
arguments: label: D198
type_infered: string
name: disassemble_data
arguments: label: D301
type_infered: string
name: disassemble_data
arguments: label: D260
type_infered: string
name: disassemble_data
arguments: label: D167
type_infered: string
name: disassemble_data
arguments: label: D67
type_infered: string
name: disassemble_data
arguments: label: D5
type_infered: string
name: disassemble_data
arguments: label: D89
type_infered: string
name: disassemble_data
arguments: label: D99
type_infered: string
name: disassemble_data
arguments: label: D213
type_infered: string
name: disassemble_data
arguments: label: D134
type_infered: string
name: disassemble_data
arguments: label: D128
type_infered: string
name: disassemble_data
arguments: label: D187
type_infered: string
name: disassemble_data
arguments: label: D282
type_infered: string
name: disassemble_data
arguments: label: D253
type_infered: string
name: disassemble_data
arguments: label: D297
type_infered: string
name: disassemble_data
arguments: label: D38
type_infered: string
name: disassemble_data
arguments: label: D141
type_infered: string
name: disassemble_data
arguments: label: D40
type_infered: string
name: disassemble_data
arguments: label: D173
type_infered: string
name: disassemble_data
arguments: label: D123
type_infered: string

tool: D15: Enter the total no. of elements in the array.

tool: D250: %d

tool: D201: Enter the elements of the array.

tool: D198: 
Enter the index no. Remember that indexing starts from 0 in the array.


tool: D301: 
Enter the new value.

tool: D260: Updated the value of index no %d to %d


tool: D167: This index does not exist. Please choose an index between 0 to %d both inclusive.


tool: D67: 
Enter the old value followed by the new value.


tool: D5: %d%d

tool: D89: Updated value at the ind no. %d to %d.


tool: D99: This value is not present in the array.

tool: D213: 
Your choice doesn't match any of the available options

tool: D134: 
Enter the index to be deleted.Remember that indexing starts from 0.

tool: D128: 

Deleted index no %d. New size of the array is %d


tool: D187: 
%d index is out of the array size.


tool: D282: Enter the element value to be deleted.

tool: D253: 
Deleted element %d. New size of the array is %d


tool: D297: 
%d is not present in the array, hence can't be deleted.


tool: D38: Enter the value of the elem] to be searched in the array.

tool: D141: %d is present at the index %d.


tool: D40: %d is not present in the array


tool: D173: size of the array is %d


tool: D123: None of the choices you eneterd matches the given choices.

assistant: ```c
int main() {
  int n;
  printf("Enter the total no. of elements in the array.\n");
  scanf("%d", &n);
  int *a = (int *)malloc(sizeof(int) * n);
  printf("Enter the elements of the array.\n");
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  mainchoices();
  int ch;
  scanf("%d", &ch);
  while (ch != -1) {
    if (ch == 1) {
      changechoices();
      int chch;
      scanf("%d", &chch);
      if (chch == 1) {
        printf("\nEnter the index no. Remember that indexing starts from 0 in the array.\n\n");
        int ind, value;
        scanf("%d", &ind);
        if (ind < n && ind >= 0) {
          printf("\nEnter the new value.\n");
          scanf("%d", &value);
          updateByIndex(a, ind, value);
          printf("Updated the value of index no %d to %d\n", ind, value);
        } else {
          printf("This index does not exist. Please choose an index between 0 to %d both inclusive.\n", n - 1);
          mainchoices();
        }
      } else if (chch == 2) {
        printf("\nEnter the old value followed by the new value.\n\n");
        int oldv, newv;
        scanf("%d%d", &oldv, &newv);
        int in = search(a, oldv, n);
        if (in < n) {
          a[n] = newv;
          printf("Updated value at the ind no. %d to %d.\n", in, newv);
        } else {
          printf("This value is not present in the array.\n");
          mainchoices();
        }
      } else {
        printf("\nYour choice doesn't match any of the available options\n");
        mainchoices();
      }
    } else if (ch == 2) {
      deletechoices();
      int chdel;
      scanf("%d", &chdel);
      if (chdel == 1) {
        int ind;
        printf("\nEnter the index to be deleted.Remember that indexing starts from 0.\n");
        scanf("%d", &ind);
        if (ind < n) {
          n = deleteindex(a, ind, n);
          printf("\n\nDeleted index no %d. New size of the array is %d\n", ind, n);
        } else {
          printf("\n%d index is out of the array size.\n", ind);
          mainchoices();
        }
      } else if (chdel == 2) {
        printf("Enter the element value to be deleted.\n");
        int del;
        scanf("%d", &del);
        int ind = search(a, del, n);
        if (ind < n) {
          n = deleteindex(a, ind, n);
          printf("\nDeleted element %d. New size of the array is %d\n", del, n);
        } else {
          printf("\n%d is not present in the array, hence can't be deleted.\n", del);
        }
      }
    } else if (ch == 3) {
      printf("Enter the value of the elem] to be searched in the array.\n");
      int val;
      scanf("%d", &val);
      int fo = search(a, val, n);
      if (fo < n) {
        printf("%d is present at the index %d.\n", val, fo);
      } else {
        printf("%d is not present in the array\n", val);
      }
    } else if (ch == 4) {
      printfun(a, n);
    } else if (ch == 5) {
      printf("size of the array is %d\n", n);
    } else {
      printf("None of the choices you eneterd matches the given choices.\n");
      mainchoices();
    }
    mainchoices();
    scanf("%d", &ch);
  }
}
```