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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xd0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xc4(%rbp)
  movl   $0x0,-0xbc(%rbp)
  movl   $0x0,-0xb8(%rbp)
  movl   $0x0,-0xb4(%rbp)
L59:
  lea    D283(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D359(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D88(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D243(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0xc4(%rbp),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc4(%rbp),%eax
  cmp    $0x1,%eax
  jne    L390
  nop
L295:
  lea    D431(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D345(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D255(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D113(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D51(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0xc4(%rbp),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc4(%rbp),%eax
  cmp    $0x5,%eax
  ja     L379
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D93(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D93(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  cmpl   $0x0,-0xbc(%rbp)
  jle    L164
  mov    -0xbc(%rbp),%edx
  lea    -0xb0(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <display@plt>
  jmp    L409
L164:
  lea    D175(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  jmp    L409
  lea    D309(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0xbc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xbc(%rbp)
  lea    -0xb0(%rbp),%rdx
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xbc(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xb4(%rbp)
  jmp    L334
L325:
  mov    -0xb4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%edx
  mov    -0xb4(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  cmp    %eax,%edx
  jge    L32
  mov    -0xb4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%edx
  mov    -0xb4(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  lea    (%rdx,%rax,1),%ecx
  mov    -0xb4(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%edx
  mov    -0xb4(%rbp),%eax
  cltq
  mov    %edx,-0xb0(%rbp,%rax,4)
  mov    -0xb4(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%esi
  mov    -0xb4(%rbp),%eax
  sub    $0x1,%eax
  sub    %esi,%ecx
  mov    %ecx,%edx
  cltq
  mov    %edx,-0xb0(%rbp,%rax,4)
L32:
  subl   $0x1,-0xb4(%rbp)
L334:
  cmpl   $0x0,-0xb4(%rbp)
  jg     L325
  mov    -0xbc(%rbp),%edx
  lea    -0xb0(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <display@plt>
  jmp    L409
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0xc0(%rbp),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc0(%rbp),%eax
  mov    -0xbc(%rbp),%edx
  lea    -0xb0(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <binarysearch@plt>
  mov    %eax,-0xb4(%rbp)
  cmpl   $0x0,-0xb4(%rbp)
  js     L199
  subl   $0x1,-0xbc(%rbp)
  jmp    L246
L136:
  mov    -0xb4(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%edx
  mov    -0xb4(%rbp),%eax
  cltq
  mov    %edx,-0xb0(%rbp,%rax,4)
  addl   $0x1,-0xb4(%rbp)
L246:
  mov    -0xb4(%rbp),%eax
  cmp    -0xbc(%rbp),%eax
  jle    L136
  jmp    L15
L199:
  lea    D433(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L15:
  mov    -0xbc(%rbp),%edx
  lea    -0xb0(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <display@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  jmp    L409
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0xc0(%rbp),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc0(%rbp),%eax
  mov    -0xbc(%rbp),%edx
  lea    -0xb0(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <binarysearch@plt>
  mov    %eax,-0xb4(%rbp)
  cmpl   $0x0,-0xb4(%rbp)
  js     L303
  mov    -0xb4(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%esi
  lea    D304(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L156
L303:
  lea    D433(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L156:
  mov    $0x0,%eax
  call   <getchar@plt>
  jmp    L409
  lea    D288(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L59
L379:
  lea    D128(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  nop
L409:
  jmp    L295
L390:
  mov    -0xc4(%rbp),%eax
  cmp    $0x2,%eax
  jne    L184
  nop
L72:
  lea    D217(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D345(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D255(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D113(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D51(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0xc4(%rbp),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc4(%rbp),%eax
  cmp    $0x5,%eax
  ja     L91
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D377(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D377(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  cmpl   $0x0,-0xb8(%rbp)
  jle    L178
  mov    -0xb8(%rbp),%edx
  lea    -0x60(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <display@plt>
  jmp    L400
L178:
  lea    D175(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L400
  lea    D309(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0xb8(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xb8(%rbp)
  lea    -0x60(%rbp),%rdx
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xb8(%rbp),%edx
  lea    -0x60(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <display@plt>
  jmp    L400
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0xc0(%rbp),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  movl   $0x0,-0xb4(%rbp)
  jmp    L405
L345:
  mov    -0xb4(%rbp),%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%edx
  mov    -0xc0(%rbp),%eax
  cmp    %eax,%edx
  je     L410
  mov    -0xb8(%rbp),%eax
  sub    -0xb4(%rbp),%eax
  cmp    $0x1,%eax
  jne    L323
  lea    D138(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0xffffffff,-0xb4(%rbp)
  mov    $0x0,%eax
  call   <getchar@plt>
L323:
  addl   $0x1,-0xb4(%rbp)
L405:
  mov    -0xb4(%rbp),%eax
  cmp    -0xb8(%rbp),%eax
  jl     L345
  jmp    L394
L410:
  nop
L394:
  cmpl   $0x0,-0xb4(%rbp)
  js     L122
  subl   $0x1,-0xb8(%rbp)
  mov    -0xb8(%rbp),%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%edx
  mov    -0xb4(%rbp),%eax
  cltq
  mov    %edx,-0x60(%rbp,%rax,4)
  mov    -0xb8(%rbp),%edx
  lea    -0x60(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <display@plt>
  jmp    L122
  lea    D61(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0xc0(%rbp),%rax
  mov    %rax,%rsi
  lea    D35(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  movl   $0x0,-0xb4(%rbp)
  jmp    L109
L13:
  mov    -0xb4(%rbp),%eax
  cltq
  mov    -0x60(%rbp,%rax,4),%edx
  mov    -0xc0(%rbp),%eax
  cmp    %eax,%edx
  jne    L167
  mov    -0xb4(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%esi
  lea    D366(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L247
L167:
  mov    -0xb8(%rbp),%eax
  sub    -0xb4(%rbp),%eax
  cmp    $0x1,%eax
  jne    L26
  lea    D138(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L26:
  addl   $0x1,-0xb4(%rbp)
L109:
  mov    -0xb4(%rbp),%eax
  cmp    -0xb8(%rbp),%eax
  jl     L13
L247:
  mov    $0x0,%eax
  call   <getchar@plt>
  jmp    L400
  lea    D288(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L59
L91:
  lea    D128(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <getchar@plt>
  jmp    L400
L122:
  nop
L400:
  jmp    L72
L184:
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L322
  call   <__stack_chk_fail@plt>
L322:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: label: D283
data_type: string
name: retrieve_data
arguments: label: D359
data_type: string
name: retrieve_data
arguments: label: D88
data_type: string
name: retrieve_data
arguments: label: D243
data_type: string
name: retrieve_data
arguments: label: D35
data_type: string
name: retrieve_data
arguments: label: D431
data_type: string
name: retrieve_data
arguments: label: D345
data_type: string
name: retrieve_data
arguments: label: D255
data_type: string
name: retrieve_data
arguments: label: D113
data_type: string
name: retrieve_data
arguments: label: D51
data_type: string
name: retrieve_data
arguments: label: D175
data_type: string
name: retrieve_data
arguments: label: D309
data_type: string
name: retrieve_data
arguments: label: D61
data_type: string
name: retrieve_data
arguments: label: D433
data_type: string
name: retrieve_data
arguments: label: D304
data_type: string
name: retrieve_data
arguments: label: D288
data_type: string
name: retrieve_data
arguments: label: D128
data_type: string
name: retrieve_data
arguments: label: D217
data_type: string
name: retrieve_data
arguments: label: D138
data_type: string
name: retrieve_data
arguments: label: D366
data_type: string

tool: D283: Type of Array 

tool: D359: 
1. Ordered

tool: D88: 
2. Unordered

tool: D243: 

Press any other key to exit

tool: D35: %d

tool: D431: 


1. Display array 

tool: D345: 
2. Add value

tool: D255: 
3. Remove value

tool: D113: 
4. Search value

tool: D51: 
5. Return to main menu

tool: D175: 
Array is empty

tool: D309: 

Enter the value 

tool: D61: 


Enter the value 

tool: D433: 
Element not Found

tool: D304: 
Element Found at position %d

tool: D288: 




tool: D128: 

Your entered invalid option

tool: D217: 


1. Display array

tool: D138: 
Element not found

tool: D366: 
Element found at position %d

assistant: ```c
int main() {
  int choice = 0, oi = 0, uoi = 0, i = 0, data, oarray[20], uarray[20];
start:
  printf("Type of Array ");
  printf("\n1. Ordered");
  printf("\n2. Unordered");
  printf("\n\nPress any other key to exit\n");
  scanf("%d", &choice);
  if (choice == 1) {
  sub1:
    printf("\n\n\n1. Display array ");
    printf("\n2. Add value");
    printf("\n3. Remove value");
    printf("\n4. Search value");
    printf("\n5. Return to main menu\n");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      if (oi > 0)
        display(oarray, oi);
      else {
        printf("\nArray is empty\n");
        getchar();
      }
      break;
    case 2:
      printf("\n\nEnter the value ");
      scanf("%d", &oarray[oi++]);
      for (i = oi - 1; i > 0; i--) {
        if (oarray[i] < oarray[i - 1])
          oarray[i - 1] = oarray[i] + oarray[i - 1] - (oarray[i] = oarray[i - 1]);
      }
      display(oarray, oi);
      break;
    case 3:
      printf("\n\n\nEnter the value ");
      scanf("%d", &data);
      i = binarysearch(data, oarray, oi);
      if (i >= 0) {
        oi--;
        while (i <= oi) {
          oarray[i] = oarray[i + 1];
          i++;
        }
      } else
        printf("\nElement not Found");
      display(oarray, oi);
      getchar();
      break;
    case 4:
      printf("\n\n\nEnter the value ");
      scanf("%d", &data);
      i = binarysearch(data, oarray, oi);
      if (i >= 0)
        printf("\nElement Found at position %d", i + 1);
      else
        printf("\nElement not Found");
      getchar();
      break;
    case 5:
      printf("\n\n\n\n");
      goto start;
    default:
      printf("\n\nYour entered invalid option");
      getchar();
      break;
    }
    goto sub1;
  } else if (choice == 2) {
  sub2:
    printf("\n\n\n1. Display array");
    printf("\n2. Add value");
    printf("\n3. Remove value");
    printf("\n4. Search value");
    printf("\n5. Return to main menu\n");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      if (uoi > 0)
        display(uarray, uoi);
      else
        printf("\nArray is empty\n");
      break;
    case 2:
      printf("\n\nEnter the value ");
      scanf("%d", &uarray[uoi++]);
      display(uarray, uoi);
      break;
    case 3:
      printf("\n\n\nEnter the value ");
      scanf("%d", &data);
      for (i = 0; i < uoi; i++) {
        if (data == uarray[i])
          break;
        else if (uoi - i == 1) {
          printf("\nElement not found");
          i = -1;
          getchar();
        }
      }
      if (i >= 0) {
        uarray[i] = uarray[--uoi];
        display(uarray, uoi);
      }
      break;
    case 4:
      printf("\n\n\nEnter the value ");
      scanf("%d", &data);
      for (i = 0; i < uoi; i++) {
        if (data == uarray[i]) {
          printf("\nElement found at position %d", i + 1);
          break;
        } else if (uoi - i == 1)
          printf("\nElement not found");
      }
      getchar();
      break;
    case 5:
      printf("\n\n\n\n");
      goto start;
    default:
      printf("\n\nYour entered invalid option");
      getchar();
      break;
    }
    goto sub2;
  }
  return 0;
}
```