#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 /*<<< orphan*/ delete ();
int /*<<< orphan*/ display();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ findbyvalue();
int /*<<< orphan*/ insert();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ reverselist();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sortlist();
int main() {
  int ch;
  while (1) {
    printf("1. Add a number to the list\n2. Delete element of the list\n3. "
           "View list\n4. Find a value in the list\n5. Sort list\n6. Reverse "
           "the list\n7. Exit\n");
    scanf("%d", &ch);
    switch (ch) {
    case 1:
      insert();
      break;
    case 2:
      delete ();
      break;
    case 3:
      display();
      break;
    case 4:
      findbyvalue();
      break;
    case 5:
      sortlist();
      break;
    case 6:
      reverselist();
      break;
    case 7:
      exit(0);
      break;
    default:
      printf("invalid");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
lea    0xef7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     1233 <main+0xa3>
mov    -0x10(%rbp),%rax
lea    0xe25(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <insert@plt>
jmp    123f <main+0xaf>
mov    $0x0,%al
call   1080 <delete@plt>
jmp    123f <main+0xaf>
mov    $0x0,%al
call   1030 <display@plt>
jmp    123f <main+0xaf>
mov    $0x0,%al
call   10b0 <findbyvalue@plt>
jmp    123f <main+0xaf>
mov    $0x0,%al
call   1050 <sortlist@plt>
jmp    123f <main+0xaf>
mov    $0x0,%al
call   10a0 <reverselist@plt>
jmp    123f <main+0xaf>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
jmp    119f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe73(%rip),%r14
lea    0xe61(%rip),%r15
lea    0xc(%rsp),%r13
lea    0xe58(%rip),%r12
lea    0xe32(%rip),%rbx
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   10b0 <reverselist@plt>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x6,%eax
ja     1211 <main+0x71>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1080 <insert@plt>
jmp    11e0 <main+0x40>
mov    %r12,%rdi
call   1050 <printf@plt>
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   1090 <delete@plt>
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   1040 <display@plt>
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   10c0 <findbyvalue@plt>
jmp    11e0 <main+0x40>
xor    %eax,%eax
call   1060 <sortlist@plt>
jmp    11e0 <main+0x40>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [141 x i8] c"1. Add a number to the list\0A2. Delete element of the list\0A3. View list\0A4. Find a value in the list\0A5. Sort list\0A6. Reverse the list\0A7. Exit\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"invalid\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %23
%4 = call i32 @printf(i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
switch i32 %6, label %21 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
i32 5, label %15
i32 6, label %17
i32 7, label %19
]
7: ; preds = %3
%8 = call i32 (...) @insert()
br label %23
9: ; preds = %3
%10 = call i32 (...) @delete()
br label %23
11: ; preds = %3
%12 = call i32 (...) @display()
br label %23
13: ; preds = %3
%14 = call i32 (...) @findbyvalue()
br label %23
15: ; preds = %3
%16 = call i32 (...) @sortlist()
br label %23
17: ; preds = %3
%18 = call i32 (...) @reverselist()
br label %23
19: ; preds = %3
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %3
%22 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %17, %15, %13, %11, %9, %7
br label %3
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"invalid\00"
@str = [140 x i8] c"1. Add a number to the list\0A2. Delete element of the list\0A3. View list\0A4. Find a value in the list\0A5. Sort list\0A6. Reverse the list\0A7. Exit\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %23, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([140 x i8], [140 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
switch i32 %6, label %21 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
i32 5, label %15
i32 6, label %17
i32 7, label %19
]
7: ; preds = %3
%8 = call i32 (...) @insert()
br label %23
9: ; preds = %3
%10 = call i32 (...) @delete()
br label %23
11: ; preds = %3
%12 = call i32 (...) @display()
br label %23
13: ; preds = %3
%14 = call i32 (...) @findbyvalue()
br label %23
15: ; preds = %3
%16 = call i32 (...) @sortlist()
br label %23
17: ; preds = %3
%18 = call i32 (...) @reverselist()
br label %23
19: ; preds = %3
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %3
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %17, %15, %13, %11, %9, %7
br label %3
}