#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int binarysearch(int, int *, int);
int /*<<< orphan*/ display(int *, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
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;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf64(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    1495 <main+0x345>
jmp    11d5 <main+0x85>
lea    0xe94(%rip),%rdi
xor    %eax,%eax
mov    %al,-0xc9(%rbp)
call   1050 <printf@plt>
mov    -0xc9(%rbp),%al
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
mov    -0xc9(%rbp),%al
lea    0xe8b(%rip),%rdi
call   1050 <printf@plt>
mov    -0xc9(%rbp),%al
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
mov    -0xc9(%rbp),%al
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
lea    0xee9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0xc8(%rbp)
sub    $0x4,%eax
ja     147b <main+0x32b>
mov    -0xc8(%rbp),%rax
lea    0xdad(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x0,-0xc(%rbp)
jle    128b <main+0x13b>
lea    -0x70(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <display@plt>
jmp    12a0 <main+0x150>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    1490 <main+0x340>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
lea    -0x70(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe4f(%rip),%rdi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    134e <main+0x1fe>
movslq -0x14(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
jge    133b <main+0x1eb>
movslq -0x14(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%ecx
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
add    -0x70(%rbp,%rax,4),%ecx
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x70(%rbp,%rax,4),%eax
movslq -0x14(%rbp),%rdx
mov    %eax,-0x70(%rbp,%rdx,4)
sub    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    1340 <main+0x1f0>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    12e0 <main+0x190>
lea    -0x70(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <display@plt>
jmp    1490 <main+0x340>
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdad(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x18(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <binarysearch@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     13d5 <main+0x285>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     13d0 <main+0x280>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x70(%rbp,%rax,4),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x70(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13a2 <main+0x252>
jmp    13e3 <main+0x293>
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <display@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    1490 <main+0x340>
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd11(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x18(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <binarysearch@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     144e <main+0x2fe>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    145c <main+0x30c>
lea    0xc9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    1490 <main+0x340>
lea    0xcb5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    117e <main+0x2e>
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    11d5 <main+0x85>
cmpl   $0x2,-0x8(%rbp)
jne    174d <main+0x5fd>
jmp    14a4 <main+0x354>
lea    0xc9c(%rip),%rdi
xor    %eax,%eax
mov    %al,-0xd9(%rbp)
call   1050 <printf@plt>
mov    -0xd9(%rbp),%al
lea    0xbc0(%rip),%rdi
call   1050 <printf@plt>
mov    -0xd9(%rbp),%al
lea    0xbbc(%rip),%rdi
call   1050 <printf@plt>
mov    -0xd9(%rbp),%al
lea    0xbbb(%rip),%rdi
call   1050 <printf@plt>
mov    -0xd9(%rbp),%al
lea    0xbba(%rip),%rdi
call   1050 <printf@plt>
lea    0xc1a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0xd8(%rbp)
sub    $0x4,%eax
ja     1733 <main+0x5e3>
mov    -0xd8(%rbp),%rax
lea    0xaca(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x0,-0x10(%rbp)
jle    155d <main+0x40d>
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <display@plt>
jmp    156b <main+0x41b>
lea    0xb6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1748 <main+0x5f8>
lea    0xb69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
lea    -0xc0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xb81(%rip),%rdi
call   1070 <scanf@plt>
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <display@plt>
jmp    1748 <main+0x5f8>
lea    0xb1f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xb53(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1646 <main+0x4f6>
mov    -0x18(%rbp),%eax
movslq -0x14(%rbp),%rcx
cmp    -0xc0(%rbp,%rcx,4),%eax
jne    1603 <main+0x4b3>
jmp    1646 <main+0x4f6>
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
cmp    $0x1,%eax
jne    162e <main+0x4de>
lea    0xb42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x14(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    1633 <main+0x4e3>
jmp    1638 <main+0x4e8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    15de <main+0x48e>
cmpl   $0x0,-0x14(%rbp)
jl     167c <main+0x52c>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
cltq
mov    -0xc0(%rbp,%rax,4),%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0xc0(%rbp,%rax,4)
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <display@plt>
jmp    1748 <main+0x5f8>
lea    0xa57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xa8b(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1714 <main+0x5c4>
mov    -0x18(%rbp),%eax
movslq -0x14(%rbp),%rcx
cmp    -0xc0(%rbp,%rcx,4),%eax
jne    16df <main+0x58f>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xa9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1714 <main+0x5c4>
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
cmp    $0x1,%eax
jne    16fc <main+0x5ac>
lea    0xa66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1701 <main+0x5b1>
jmp    1706 <main+0x5b6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    16a6 <main+0x556>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    1748 <main+0x5f8>
lea    0x9fd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    117e <main+0x2e>
lea    0x9ef(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
jmp    14a4 <main+0x354>
jmp    1752 <main+0x602>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movl   $0x0,0x8(%rsp)
lea    0xf58(%rip),%r13
lea    0xf86(%rip),%r15
lea    0xec3(%rip),%r14
lea    0xe7f(%rip),%rbx
movl   $0x0,0xc(%rsp)
xor    %r12d,%r12d
jmp    11ca <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xfbd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8e(%rip),%r14
lea    0xe4a(%rip),%rbx
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf43(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x2,%eax
je     154e <main+0x3ee>
cmp    $0x1,%eax
mov    0xc(%rsp),%ebp
jne    1751 <main+0x5f1>
jmp    1245 <main+0xe5>
nopl   0x0(%rax)
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe13(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1230 <main+0xd0>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
test   %ebp,%ebp
jle    1307 <main+0x1a7>
lea    0x10(%rsp),%rdi
mov    %ebp,%esi
call   1040 <display@plt>
jmp    1245 <main+0xe5>
nopl   0x0(%rax)
lea    0xdcf(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%edi
lea    0x10(%rsp),%rsi
mov    %ebp,%edx
call   1050 <binarysearch@plt>
test   %eax,%eax
js     1318 <main+0x1b8>
add    $0x1,%eax
lea    0xdc4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    123e <main+0xde>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
jmp    123e <main+0xde>
lea    0xd8b(%rip),%rdi
jmp    1237 <main+0xd7>
lea    0xd6c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x1(%rbp),%eax
mov    %eax,0xc(%rsp)
movslq %ebp,%rax
lea    (%rsp,%rax,4),%rsi
add    $0x10,%rsi
mov    %r13,%rdi
call   1080 <scanf@plt>
test   %ebp,%ebp
jle    137e <main+0x21e>
mov    %rbp,%rdx
mov    %ebp,%ecx
test   $0x1,%cl
jne    135f <main+0x1ff>
mov    %rcx,%rax
jmp    1379 <main+0x219>
mov    0x10(%rsp,%rcx,4),%ebp
lea    -0x1(%rcx),%rax
mov    %eax,%esi
mov    0x10(%rsp,%rsi,4),%edi
cmp    %edi,%ebp
jge    1379 <main+0x219>
mov    %edi,0x10(%rsp,%rcx,4)
mov    %ebp,0x10(%rsp,%rsi,4)
cmp    $0x1,%edx
jne    1393 <main+0x233>
lea    0x10(%rsp),%rdi
mov    0xc(%rsp),%ebp
mov    %ebp,%esi
call   1040 <display@plt>
jmp    1245 <main+0xe5>
add    $0x1,%rax
jmp    13aa <main+0x24a>
nopl   0x0(%rax)
add    $0xfffffffffffffffe,%rax
cmp    $0x1,%rax
jbe    137e <main+0x21e>
mov    0xc(%rsp,%rax,4),%ecx
lea    -0x2(%rax),%edx
mov    0x10(%rsp,%rdx,4),%esi
cmp    %esi,%ecx
jge    13c1 <main+0x261>
mov    %esi,0xc(%rsp,%rax,4)
mov    %ecx,0x10(%rsp,%rdx,4)
mov    0x8(%rsp,%rax,4),%ecx
lea    -0x3(%rax),%edx
mov    0x10(%rsp,%rdx,4),%esi
cmp    %esi,%ecx
jge    13a0 <main+0x240>
mov    %esi,0x8(%rsp,%rax,4)
mov    %ecx,0x10(%rsp,%rdx,4)
jmp    13a0 <main+0x240>
nopw   0x0(%rax,%rax,1)
lea    0xcaf(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%edi
lea    0x10(%rsp),%rsi
mov    %ebp,%edx
call   1050 <binarysearch@plt>
test   %eax,%eax
js     14cb <main+0x36b>
lea    -0x1(%rbp),%r9d
cmp    %ebp,%eax
jge    1504 <main+0x3a4>
mov    %eax,%eax
movslq %ebp,%rdx
mov    %rdx,%rsi
sub    %rax,%rsi
cmp    $0x8,%rsi
jb     14f0 <main+0x390>
mov    %rbx,%r10
mov    %rsi,%r8
and    $0xfffffffffffffff8,%r8
lea    -0x8(%r8),%rcx
mov    %rcx,%rdi
shr    $0x3,%rdi
add    $0x1,%rdi
test   %rcx,%rcx
je     151f <main+0x3bf>
mov    %rdi,%rbp
and    $0xfffffffffffffffe,%rbp
lea    0x44(%rsp),%rcx
lea    (%rcx,%rax,4),%rcx
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movups -0x30(%rcx,%rbx,4),%xmm0
movups -0x20(%rcx,%rbx,4),%xmm1
movups -0x10(%rcx,%rbx,4),%xmm2
movups (%rcx,%rbx,4),%xmm3
movups %xmm0,-0x34(%rcx,%rbx,4)
movups %xmm1,-0x24(%rcx,%rbx,4)
movups %xmm2,-0x14(%rcx,%rbx,4)
movups %xmm3,-0x4(%rcx,%rbx,4)
add    $0x10,%rbx
add    $0xfffffffffffffffe,%rbp
jne    1470 <main+0x310>
test   $0x1,%dil
je     14be <main+0x35e>
add    %rax,%rbx
movups 0x14(%rsp,%rbx,4),%xmm0
movups 0x24(%rsp,%rbx,4),%xmm1
movups %xmm0,0x10(%rsp,%rbx,4)
movups %xmm1,0x20(%rsp,%rbx,4)
cmp    %r8,%rsi
jne    14db <main+0x37b>
mov    %r9d,%ebp
mov    %r10,%rbx
jmp    1507 <main+0x3a7>
lea    0xbd8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1507 <main+0x3a7>
add    %r8,%rax
mov    %r10,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x14(%rsp,%rax,4),%ecx
mov    %ecx,0x10(%rsp,%rax,4)
lea    0x1(%rax),%rcx
mov    %rcx,%rax
cmp    %rcx,%rdx
jne    14f0 <main+0x390>
mov    %r9d,%ebp
lea    0x10(%rsp),%rdi
mov    %ebp,%esi
call   1040 <display@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
jmp    1227 <main+0xc7>
xor    %ebx,%ebx
test   $0x1,%dil
jne    14a7 <main+0x347>
jmp    14be <main+0x35e>
nopl   0x0(%rax)
movslq %r12d,%rax
add    $0xffffffff,%r12d
mov    0x5c(%rsp,%rax,4),%eax
mov    %ebx,%ecx
mov    %eax,0x60(%rsp,%rcx,4)
lea    0x60(%rsp),%rdi
mov    %r12d,%esi
call   1040 <display@plt>
mov    %r12d,%ebp
lea    -0x1(%rbp),%r14
jmp    1576 <main+0x416>
add    $0x1,%r13d
lea    0xbbe(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %rbx,%r13
lea    0xb7c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xadb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xadb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xade(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xba7(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1600 <main+0x4a0>
lea    0xa26(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
test   %r12d,%r12d
jle    16fd <main+0x59d>
lea    0x60(%rsp),%rdi
mov    %r12d,%esi
call   1040 <display@plt>
jmp    1576 <main+0x416>
xchg   %ax,%ax
lea    0xad4(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
jmp    1576 <main+0x416>
nopw   0x0(%rax,%rax,1)
xor    %ebx,%ebx
lea    0xa6d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
test   %r12d,%r12d
jle    1530 <main+0x3d0>
xor    %ebx,%ebx
jmp    165c <main+0x4fc>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %ebx,%r12d
jle    16f0 <main+0x590>
mov    0x4(%rsp),%eax
movslq %ebx,%rcx
cmp    0x60(%rsp,%rcx,4),%eax
je     16f0 <main+0x590>
mov    %r12d,%eax
sub    %ebx,%eax
cmp    $0x1,%eax
jne    1650 <main+0x4f0>
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    $0xffffffff,%ebx
jmp    1650 <main+0x4f0>
nop
lea    0x9ff(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rbx
mov    %r13,%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
test   %r12d,%r12d
jle    156c <main+0x40c>
xor    %r13d,%r13d
jmp    16cd <main+0x56d>
nopl   0x0(%rax)
add    $0x1,%r13
cmp    %r13,%rbp
je     156c <main+0x40c>
mov    0x4(%rsp),%eax
cmp    0x60(%rsp,%r13,4),%eax
je     1557 <main+0x3f7>
cmp    %r13d,%r14d
jne    16c0 <main+0x560>
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    16c0 <main+0x560>
nopl   (%rax)
test   %ebx,%ebx
js     1576 <main+0x416>
jmp    1530 <main+0x3d0>
lea    0xa74(%rip),%rdi
call   1030 <puts@plt>
jmp    1576 <main+0x416>
xchg   %ax,%ax
lea    0x980(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movslq %r12d,%rax
add    $0x1,%r12d
lea    (%rsp,%rax,4),%rsi
add    $0x60,%rsi
mov    %r13,%rdi
call   1080 <scanf@plt>
jmp    1541 <main+0x3e1>
lea    0xa33(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
mov    %ebp,0xc(%rsp)
jmp    11ca <main+0x6a>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Type of Array \00"
@.str.1 = [12 x i8] c"\0A1. Ordered\00"
@.str.2 = [14 x i8] c"\0A2. Unordered\00"
@.str.3 = [31 x i8] c"\0A\0APress any other key to exit\0A\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [21 x i8] c"\0A\0A\0A1. Display array \00"
@.str.6 = [14 x i8] c"\0A2. Add value\00"
@.str.7 = [17 x i8] c"\0A3. Remove value\00"
@.str.8 = [17 x i8] c"\0A4. Search value\00"
@.str.9 = [25 x i8] c"\0A5. Return to main menu\0A\00"
@.str.10 = [17 x i8] c"\0AArray is empty\0A\00"
@.str.11 = [19 x i8] c"\0A\0AEnter the value \00"
@.str.12 = [20 x i8] c"\0A\0A\0AEnter the value \00"
@.str.13 = [19 x i8] c"\0AElement not Found\00"
@.str.14 = [30 x i8] c"\0AElement Found at position %d\00"
@.str.15 = [5 x i8] c"\0A\0A\0A\0A\00"
@.str.16 = [30 x i8] c"\0A\0AYour entered invalid option\00"
@.str.17 = [20 x i8] c"\0A\0A\0A1. Display array\00"
@.str.18 = [19 x i8] c"\0AElement not found\00"
@.str.19 = [30 x i8] c"\0AElement found at position %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [20 x i32]
%8 = alloca [20 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %9
9: ; preds = %258, %144, %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %150
17: ; preds = %9
br label %18
18: ; preds = %149, %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%25 = load i32, i32* %2
switch i32 %25, label %146 [
i32 1, label %26
i32 2, label %37
i32 3, label %92
i32 4, label %127
i32 5, label %144
]
26: ; preds = %18
%27 = load i32, i32* %3
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 0
%31 = load i32, i32* %3
%32 = call i32 @display(i32* %30, i32 %31)
br label %36
33: ; preds = %26
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%35 = call i32 (...) @getchar()
br label %36
36: ; preds = %33, %29
br label %149
37: ; preds = %18
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %41
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %42)
%44 = load i32, i32* %3
%45 = sub nsw i32 %44, 1
store i32 %45, i32* %5
br label %46
46: ; preds = %85, %37
%47 = load i32, i32* %5
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %88
49: ; preds = %46
%50 = load i32, i32* %5
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = load i32, i32* %5
%55 = sub nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = icmp slt i32 %53, %58
br i1 %59, label %60, label %84
60: ; preds = %49
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = load i32, i32* %5
%66 = sub nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %67
%69 = load i32, i32* %68
%70 = add nsw i32 %64, %69
%71 = load i32, i32* %5
%72 = sub nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %73
%75 = load i32, i32* %74
%76 = load i32, i32* %5
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %77
store i32 %75, i32* %78
%79 = sub nsw i32 %70, %75
%80 = load i32, i32* %5
%81 = sub nsw i32 %80, 1
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %82
store i32 %79, i32* %83
br label %84
84: ; preds = %60, %49
br label %85
85: ; preds = %84
%86 = load i32, i32* %5
%87 = add nsw i32 %86, -1
store i32 %87, i32* %5
br label %46
88: ; preds = %46
%89 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 0
%90 = load i32, i32* %3
%91 = call i32 @display(i32* %89, i32 %90)
br label %149
92: ; preds = %18
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%94 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%95 = load i32, i32* %6
%96 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 0
%97 = load i32, i32* %3
%98 = call i32 @binarysearch(i32 %95, i32* %96, i32 %97)
store i32 %98, i32* %5
%99 = load i32, i32* %5
%100 = icmp sge i32 %99, 0
br i1 %100, label %101, label %120
101: ; preds = %92
%102 = load i32, i32* %3
%103 = add nsw i32 %102, -1
store i32 %103, i32* %3
br label %104
104: ; preds = %108, %101
%105 = load i32, i32* %5
%106 = load i32, i32* %3
%107 = icmp sle i32 %105, %106
br i1 %107, label %108, label %119
108: ; preds = %104
%109 = load i32, i32* %5
%110 = add nsw i32 %109, 1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %111
%113 = load i32, i32* %112
%114 = load i32, i32* %5
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %115
store i32 %113, i32* %116
%117 = load i32, i32* %5
%118 = add nsw i32 %117, 1
store i32 %118, i32* %5
br label %104
119: ; preds = %104
br label %122
120: ; preds = %92
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
br label %122
122: ; preds = %120, %119
%123 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 0
%124 = load i32, i32* %3
%125 = call i32 @display(i32* %123, i32 %124)
%126 = call i32 (...) @getchar()
br label %149
127: ; preds = %18
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%129 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%130 = load i32, i32* %6
%131 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 0
%132 = load i32, i32* %3
%133 = call i32 @binarysearch(i32 %130, i32* %131, i32 %132)
store i32 %133, i32* %5
%134 = load i32, i32* %5
%135 = icmp sge i32 %134, 0
br i1 %135, label %136, label %140
136: ; preds = %127
%137 = load i32, i32* %5
%138 = add nsw i32 %137, 1
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), i32 %138)
br label %142
140: ; preds = %127
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
br label %142
142: ; preds = %140, %136
%143 = call i32 (...) @getchar()
br label %149
144: ; preds = %18
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
br label %9
146: ; preds = %18
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
%148 = call i32 (...) @getchar()
br label %149
149: ; preds = %146, %142, %122, %88, %36
br label %18
150: ; preds = %9
%151 = load i32, i32* %2
%152 = icmp eq i32 %151, 2
br i1 %152, label %153, label %264
153: ; preds = %150
br label %154
154: ; preds = %263, %153
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0))
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%160 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%161 = load i32, i32* %2
switch i32 %161, label %260 [
i32 1, label %162
i32 2, label %172
i32 3, label %182
i32 4, label %226
i32 5, label %258
]
162: ; preds = %154
%163 = load i32, i32* %4
%164 = icmp sgt i32 %163, 0
br i1 %164, label %165, label %169
165: ; preds = %162
%166 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 0
%167 = load i32, i32* %4
%168 = call i32 @display(i32* %166, i32 %167)
br label %171
169: ; preds = %162
%170 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
br label %171
171: ; preds = %169, %165
br label %263
172: ; preds = %154
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%174 = load i32, i32* %4
%175 = add nsw i32 %174, 1
store i32 %175, i32* %4
%176 = sext i32 %174 to i64
%177 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 %176
%178 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %177)
%179 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 0
%180 = load i32, i32* %4
%181 = call i32 @display(i32* %179, i32 %180)
br label %263
182: ; preds = %154
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%184 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
store i32 0, i32* %5
br label %185
185: ; preds = %207, %182
%186 = load i32, i32* %5
%187 = load i32, i32* %4
%188 = icmp slt i32 %186, %187
br i1 %188, label %189, label %210
189: ; preds = %185
%190 = load i32, i32* %6
%191 = load i32, i32* %5
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 %192
%194 = load i32, i32* %193
%195 = icmp eq i32 %190, %194
br i1 %195, label %196, label %197
196: ; preds = %189
br label %210
197: ; preds = %189
%198 = load i32, i32* %4
%199 = load i32, i32* %5
%200 = sub nsw i32 %198, %199
%201 = icmp eq i32 %200, 1
br i1 %201, label %202, label %205
202: ; preds = %197
%203 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
store i32 -1, i32* %5
%204 = call i32 (...) @getchar()
br label %205
205: ; preds = %202, %197
br label %206
206: ; preds = %205
br label %207
207: ; preds = %206
%208 = load i32, i32* %5
%209 = add nsw i32 %208, 1
store i32 %209, i32* %5
br label %185
210: ; preds = %196, %185
%211 = load i32, i32* %5
%212 = icmp sge i32 %211, 0
br i1 %212, label %213, label %225
213: ; preds = %210
%214 = load i32, i32* %4
%215 = add nsw i32 %214, -1
store i32 %215, i32* %4
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 %216
%218 = load i32, i32* %217
%219 = load i32, i32* %5
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 %220
store i32 %218, i32* %221
%222 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 0
%223 = load i32, i32* %4
%224 = call i32 @display(i32* %222, i32 %223)
br label %225
225: ; preds = %213, %210
br label %263
226: ; preds = %154
%227 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%228 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
store i32 0, i32* %5
br label %229
229: ; preds = %253, %226
%230 = load i32, i32* %5
%231 = load i32, i32* %4
%232 = icmp slt i32 %230, %231
br i1 %232, label %233, label %256
233: ; preds = %229
%234 = load i32, i32* %6
%235 = load i32, i32* %5
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 %236
%238 = load i32, i32* %237
%239 = icmp eq i32 %234, %238
br i1 %239, label %240, label %244
240: ; preds = %233
%241 = load i32, i32* %5
%242 = add nsw i32 %241, 1
%243 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.19, i64 0, i64 0), i32 %242)
br label %256
244: ; preds = %233
%245 = load i32, i32* %4
%246 = load i32, i32* %5
%247 = sub nsw i32 %245, %246
%248 = icmp eq i32 %247, 1
br i1 %248, label %249, label %251
249: ; preds = %244
%250 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %251
251: ; preds = %249, %244
br label %252
252: ; preds = %251
br label %253
253: ; preds = %252
%254 = load i32, i32* %5
%255 = add nsw i32 %254, 1
store i32 %255, i32* %5
br label %229
256: ; preds = %240, %229
%257 = call i32 (...) @getchar()
br label %263
258: ; preds = %154
%259 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
br label %9
260: ; preds = %154
%261 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
%262 = call i32 (...) @getchar()
br label %263
263: ; preds = %260, %256, %225, %172, %171
br label %154
264: ; preds = %150
br label %265
265: ; preds = %264
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Type of Array \00"
@.str.1 = [12 x i8] c"\0A1. Ordered\00"
@.str.2 = [14 x i8] c"\0A2. Unordered\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [21 x i8] c"\0A\0A\0A1. Display array \00"
@.str.6 = [14 x i8] c"\0A2. Add value\00"
@.str.7 = [17 x i8] c"\0A3. Remove value\00"
@.str.8 = [17 x i8] c"\0A4. Search value\00"
@.str.11 = [19 x i8] c"\0A\0AEnter the value \00"
@.str.12 = [20 x i8] c"\0A\0A\0AEnter the value \00"
@.str.13 = [19 x i8] c"\0AElement not Found\00"
@.str.14 = [30 x i8] c"\0AElement Found at position %d\00"
@.str.16 = [30 x i8] c"\0A\0AYour entered invalid option\00"
@.str.17 = [20 x i8] c"\0A\0A\0A1. Display array\00"
@.str.18 = [19 x i8] c"\0AElement not found\00"
@.str.19 = [30 x i8] c"\0AElement found at position %d\00"
@str = [30 x i8] c"\0A\0APress any other key to exit\00"
@str.23 = [24 x i8] c"\0A5. Return to main menu\00"
@str.24 = [4 x i8] c"\0A\0A\0A\00"
@str.25 = [16 x i8] c"\0AArray is empty\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i32]
%4 = alloca [20 x i32]
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
%7 = bitcast [20 x i32]* %3 to i8*
%8 = bitcast [20 x i32]* %4 to i8*
%9 = getelementptr inbounds [20 x i32], [20 x i32]* %4, i64 0, i64 0
%10 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 0
br label %11
11: ; preds = %189, %0
%12 = phi i32 [ %174, %189 ], [ 0, %0 ]
%13 = phi i32 [ %15, %189 ], [ 0, %0 ]
br label %14
14: ; preds = %11, %279
%15 = phi i32 [ %250, %279 ], [ %13, %11 ]
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%21 = load i32, i32* %1
switch i32 %21, label %284 [
i32 1, label %173
i32 2, label %249
]
22: ; preds = %33, %173
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.23, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
switch i32 %29, label %191 [
i32 1, label %30
i32 2, label %37
i32 3, label %83
i32 4, label %176
i32 5, label %189
]
30: ; preds = %22
br i1 %175, label %31, label %34
31: ; preds = %30
%32 = call i32 @display(i32* %10, i32 %174)
br label %33
33: ; preds = %31, %34, %191, %187
br label %22
34: ; preds = %30
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.25, i64 0, i64 0))
%36 = call i32 (...) @getchar()
br label %33
37: ; preds = %22
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%39 = add nsw i32 %174, 1
%40 = sext i32 %174 to i64
%41 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %40
%42 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %41)
%43 = icmp sgt i32 %174, 0
br i1 %43, label %44, label %81
44: ; preds = %37
%45 = zext i32 %174 to i64
%46 = and i64 %45, 1
%47 = icmp eq i64 %46, 0
br i1 %47, label %57, label %48
48: ; preds = %44
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %45
%50 = load i32, i32* %49
%51 = add nsw i64 %45, -1
%52 = and i64 %51, 4294967295
%53 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = icmp slt i32 %50, %54
br i1 %55, label %56, label %57
56: ; preds = %48
store i32 %54, i32* %49
store i32 %50, i32* %53
br label %57
57: ; preds = %48, %56, %44
%58 = phi i64 [ %45, %44 ], [ %51, %56 ], [ %51, %48 ]
%59 = icmp eq i32 %174, 1
br i1 %59, label %81, label %60
60: ; preds = %57, %79
%61 = phi i64 [ %73, %79 ], [ %58, %57 ]
%62 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = add nsw i64 %61, -1
%65 = and i64 %64, 4294967295
%66 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = icmp slt i32 %63, %67
br i1 %68, label %69, label %70
69: ; preds = %60
store i32 %67, i32* %62
store i32 %63, i32* %66
br label %70
70: ; preds = %60, %69
%71 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %64
%72 = load i32, i32* %71
%73 = add nsw i64 %61, -2
%74 = and i64 %73, 4294967295
%75 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = icmp slt i32 %72, %76
br i1 %77, label %78, label %79
78: ; preds = %70
store i32 %76, i32* %71
store i32 %72, i32* %75
br label %79
79: ; preds = %78, %70
%80 = icmp ugt i64 %64, 1
br i1 %80, label %60, label %81
81: ; preds = %57, %79, %37
%82 = call i32 @display(i32* %10, i32 %39)
br label %171
83: ; preds = %22
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%85 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%86 = load i32, i32* %2
%87 = call i32 @binarysearch(i32 %86, i32* %10, i32 %174)
%88 = icmp sgt i32 %87, -1
br i1 %88, label %89, label %165
89: ; preds = %83
%90 = add nsw i32 %174, -1
%91 = icmp slt i32 %87, %174
br i1 %91, label %92, label %167
92: ; preds = %89
%93 = zext i32 %87 to i64
%94 = sext i32 %174 to i64
%95 = sub nsw i64 %94, %93
%96 = icmp ult i64 %95, 8
br i1 %96, label %156, label %97
97: ; preds = %92
%98 = and i64 %95, -8
%99 = add nsw i64 %98, %93
%100 = add nsw i64 %98, -8
%101 = lshr exact i64 %100, 3
%102 = add nuw nsw i64 %101, 1
%103 = and i64 %102, 1
%104 = icmp eq i64 %100, 0
br i1 %104, label %138, label %105
105: ; preds = %97
%106 = and i64 %102, 4611686018427387902
br label %107
107: ; preds = %107, %105
%108 = phi i64 [ 0, %105 ], [ %135, %107 ]
%109 = phi i64 [ 0, %105 ], [ %136, %107 ]
%110 = add i64 %108, %93
%111 = add nuw nsw i64 %110, 1
%112 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %111
%113 = bitcast i32* %112 to <4 x i32>*
%114 = load <4 x i32>, <4 x i32>* %113
%115 = getelementptr inbounds i32, i32* %112, i64 4
%116 = bitcast i32* %115 to <4 x i32>*
%117 = load <4 x i32>, <4 x i32>* %116
%118 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %110
%119 = bitcast i32* %118 to <4 x i32>*
store <4 x i32> %114, <4 x i32>* %119
%120 = getelementptr inbounds i32, i32* %118, i64 4
%121 = bitcast i32* %120 to <4 x i32>*
store <4 x i32> %117, <4 x i32>* %121
%122 = or i64 %108, 8
%123 = add i64 %122, %93
%124 = add nuw nsw i64 %123, 1
%125 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %124
%126 = bitcast i32* %125 to <4 x i32>*
%127 = load <4 x i32>, <4 x i32>* %126
%128 = getelementptr inbounds i32, i32* %125, i64 4
%129 = bitcast i32* %128 to <4 x i32>*
%130 = load <4 x i32>, <4 x i32>* %129
%131 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %123
%132 = bitcast i32* %131 to <4 x i32>*
store <4 x i32> %127, <4 x i32>* %132
%133 = getelementptr inbounds i32, i32* %131, i64 4
%134 = bitcast i32* %133 to <4 x i32>*
store <4 x i32> %130, <4 x i32>* %134
%135 = add nuw i64 %108, 16
%136 = add i64 %109, 2
%137 = icmp eq i64 %136, %106
br i1 %137, label %138, label %107
138: ; preds = %107, %97
%139 = phi i64 [ 0, %97 ], [ %135, %107 ]
%140 = icmp eq i64 %103, 0
br i1 %140, label %154, label %141
141: ; preds = %138
%142 = add i64 %139, %93
%143 = add nuw nsw i64 %142, 1
%144 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %143
%145 = bitcast i32* %144 to <4 x i32>*
%146 = load <4 x i32>, <4 x i32>* %145
%147 = getelementptr inbounds i32, i32* %144, i64 4
%148 = bitcast i32* %147 to <4 x i32>*
%149 = load <4 x i32>, <4 x i32>* %148
%150 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %142
%151 = bitcast i32* %150 to <4 x i32>*
store <4 x i32> %146, <4 x i32>* %151
%152 = getelementptr inbounds i32, i32* %150, i64 4
%153 = bitcast i32* %152 to <4 x i32>*
store <4 x i32> %149, <4 x i32>* %153
br label %154
154: ; preds = %138, %141
%155 = icmp eq i64 %95, %98
br i1 %155, label %167, label %156
156: ; preds = %92, %154
%157 = phi i64 [ %93, %92 ], [ %99, %154 ]
br label %158
158: ; preds = %156, %158
%159 = phi i64 [ %160, %158 ], [ %157, %156 ]
%160 = add nuw nsw i64 %159, 1
%161 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %160
%162 = load i32, i32* %161
%163 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %159
store i32 %162, i32* %163
%164 = icmp eq i64 %160, %94
br i1 %164, label %167, label %158
165: ; preds = %83
%166 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
br label %167
167: ; preds = %158, %154, %89, %165
%168 = phi i32 [ %174, %165 ], [ %90, %89 ], [ %90, %154 ], [ %90, %158 ]
%169 = call i32 @display(i32* %10, i32 %168)
%170 = call i32 (...) @getchar()
br label %171
171: ; preds = %167, %81
%172 = phi i32 [ %39, %81 ], [ %168, %167 ]
br label %173
173: ; preds = %14, %171
%174 = phi i32 [ %172, %171 ], [ %12, %14 ]
%175 = icmp sgt i32 %174, 0
br label %22
176: ; preds = %22
%177 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%178 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%179 = load i32, i32* %2
%180 = call i32 @binarysearch(i32 %179, i32* %10, i32 %174)
%181 = icmp sgt i32 %180, -1
br i1 %181, label %182, label %185
182: ; preds = %176
%183 = add nuw nsw i32 %180, 1
%184 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0), i32 %183)
br label %187
185: ; preds = %176
%186 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
br label %187
187: ; preds = %185, %182
%188 = call i32 (...) @getchar()
br label %33
189: ; preds = %22
%190 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.24, i64 0, i64 0))
br label %11
191: ; preds = %22
%192 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
%193 = call i32 (...) @getchar()
br label %33
194: ; preds = %237, %249
%195 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0))
%196 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%197 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%198 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%199 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.23, i64 0, i64 0))
%200 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%201 = load i32, i32* %1
switch i32 %201, label %281 [
i32 1, label %202
i32 2, label %207
i32 3, label %214
i32 4, label %255
i32 5, label %279
]
202: ; preds = %194
br i1 %254, label %203, label %205
203: ; preds = %202
%204 = call i32 @display(i32* %9, i32 %250)
br label %237
205: ; preds = %202
%206 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.25, i64 0, i64 0))
br label %237
207: ; preds = %194
%208 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%209 = add nsw i32 %250, 1
%210 = sext i32 %250 to i64
%211 = getelementptr inbounds [20 x i32], [20 x i32]* %4, i64 0, i64 %210
%212 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %211)
%213 = call i32 @display(i32* %9, i32 %209)
br label %247
214: ; preds = %194
%215 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%216 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
br i1 %253, label %217, label %238
217: ; preds = %214, %230
%218 = phi i32 [ %232, %230 ], [ 0, %214 ]
%219 = load i32, i32* %2
%220 = sext i32 %218 to i64
%221 = getelementptr inbounds [20 x i32], [20 x i32]* %4, i64 0, i64 %220
%222 = load i32, i32* %221
%223 = icmp eq i32 %219, %222
br i1 %223, label %234, label %224
224: ; preds = %217
%225 = sub nsw i32 %250, %218
%226 = icmp eq i32 %225, 1
br i1 %226, label %227, label %230
227: ; preds = %224
%228 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
%229 = call i32 (...) @getchar()
br label %230
230: ; preds = %227, %224
%231 = phi i32 [ -1, %227 ], [ %218, %224 ]
%232 = add nsw i32 %231, 1
%233 = icmp sgt i32 %250, %232
br i1 %233, label %217, label %234
234: ; preds = %230, %217
%235 = phi i32 [ %232, %230 ], [ %218, %217 ]
%236 = icmp sgt i32 %235, -1
br i1 %236, label %238, label %237
237: ; preds = %234, %203, %205, %281, %277
br label %194
238: ; preds = %214, %234
%239 = phi i32 [ %235, %234 ], [ 0, %214 ]
%240 = add nsw i32 %250, -1
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds [20 x i32], [20 x i32]* %4, i64 0, i64 %241
%243 = load i32, i32* %242
%244 = zext i32 %239 to i64
%245 = getelementptr inbounds [20 x i32], [20 x i32]* %4, i64 0, i64 %244
store i32 %243, i32* %245
%246 = call i32 @display(i32* %9, i32 %240)
br label %247
247: ; preds = %238, %207
%248 = phi i32 [ %209, %207 ], [ %240, %238 ]
br label %249
249: ; preds = %14, %247
%250 = phi i32 [ %248, %247 ], [ %15, %14 ]
%251 = icmp sgt i32 %250, 0
%252 = zext i32 %250 to i64
%253 = icmp sgt i32 %250, 0
%254 = icmp sgt i32 %250, 0
br label %194
255: ; preds = %194
%256 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
%257 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
br i1 %251, label %258, label %277
258: ; preds = %255, %274
%259 = phi i64 [ %275, %274 ], [ 0, %255 ]
%260 = load i32, i32* %2
%261 = getelementptr inbounds [20 x i32], [20 x i32]* %4, i64 0, i64 %259
%262 = load i32, i32* %261
%263 = icmp eq i32 %260, %262
%264 = trunc i64 %259 to i32
br i1 %263, label %265, label %269
265: ; preds = %258
%266 = trunc i64 %259 to i32
%267 = add nuw nsw i32 %266, 1
%268 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.19, i64 0, i64 0), i32 %267)
br label %277
269: ; preds = %258
%270 = sub nsw i32 %250, %264
%271 = icmp eq i32 %270, 1
br i1 %271, label %272, label %274
272: ; preds = %269
%273 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %274
274: ; preds = %272, %269
%275 = add nuw nsw i64 %259, 1
%276 = icmp eq i64 %275, %252
br i1 %276, label %277, label %258
277: ; preds = %274, %255, %265
%278 = call i32 (...) @getchar()
br label %237
279: ; preds = %194
%280 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.24, i64 0, i64 0))
br label %14
281: ; preds = %194
%282 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
%283 = call i32 (...) @getchar()
br label %237
284: ; preds = %14
ret i32 0
}