#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*/ create();
int /*<<< orphan*/ delete ();
int /*<<< orphan*/ display();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ insert();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int choice;
  printf("\nCircular Linked List\n");
  while (1) {
    printf("\n********************************************\nEnter 1 to "
           "create\nEnter 2 to insert at position\nEnter 3 to display the "
           "list\nEnter 4 to delete element at a position\nEnter 10 to "
           "exit\n********************************************\n");
    printf("Enter your choice: ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      create();
      break;
    case 2:
      insert();
      break;
    case 3:
      display();
      break;
    case 4:
      delete ();
      break;
    case 10:
      exit(0);
      break;
    default:
      printf("Wrong Choice");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
lea    0xf82(%rip),%rdi
call   1040 <printf@plt>
lea    0xf8a(%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    $0x9,%eax
ja     1213 <main+0xa3>
mov    -0x10(%rbp),%rax
lea    0xe2d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <create@plt>
jmp    121f <main+0xaf>
mov    $0x0,%al
call   1070 <insert@plt>
jmp    121f <main+0xaf>
mov    $0x0,%al
call   1030 <display@plt>
jmp    121f <main+0xaf>
mov    $0x0,%al
call   1080 <delete@plt>
jmp    121f <main+0xaf>
xor    %edi,%edi
call   1090 <exit@plt>
lea    0xf1d(%rip),%rdi
call   1040 <printf@plt>
jmp    118b <main+0x1b>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%r14
lea    0xe83(%rip),%r15
lea    0xe90(%rip),%r12
lea    0x4(%rsp),%rbx
lea    0xe87(%rip),%r13
lea    0xe41(%rip),%rbp
jmp    11d0 <main+0x50>
xor    %eax,%eax
call   1090 <delete@plt>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x9,%eax
ja     121c <main+0x9c>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <create@plt>
jmp    11d0 <main+0x50>
xor    %eax,%eax
call   1080 <insert@plt>
jmp    11d0 <main+0x50>
xor    %eax,%eax
call   1040 <display@plt>
jmp    11d0 <main+0x50>
mov    %r13,%rdi
call   1050 <printf@plt>
jmp    11d0 <main+0x50>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"\0ACircular Linked List\0A\00"
@.str.1 = [225 x i8] c"\0A********************************************\0AEnter 1 to create\0AEnter 2 to insert at position\0AEnter 3 to display the list\0AEnter 4 to delete element at a position\0AEnter 10 to exit\0A********************************************\0A\00"
@.str.2 = [20 x i8] c"Enter your choice: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [13 x i8] c"Wrong Choice\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %21
%5 = call i32 @printf(i8* getelementptr inbounds ([225 x i8], [225 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
switch i32 %8, label %19 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 10, label %17
]
9: ; preds = %4
%10 = call i32 (...) @create()
br label %21
11: ; preds = %4
%12 = call i32 (...) @insert()
br label %21
13: ; preds = %4
%14 = call i32 (...) @display()
br label %21
15: ; preds = %4
%16 = call i32 (...) @delete()
br label %21
17: ; preds = %4
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %4
%20 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %21
21: ; preds = %19, %15, %13, %11, %9
br label %4
}

LLVM IR (-O2):
@.str.2 = [20 x i8] c"Enter your choice: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [13 x i8] c"Wrong Choice\00"
@str = [22 x i8] c"\0ACircular Linked List\00"
@str.5 = [224 x i8] c"\0A********************************************\0AEnter 1 to create\0AEnter 2 to insert at position\0AEnter 3 to display the list\0AEnter 4 to delete element at a position\0AEnter 10 to exit\0A********************************************\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %21, %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([224 x i8], [224 x i8]* @str.5, i64 0, i64 0))
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
switch i32 %8, label %19 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 10, label %17
]
9: ; preds = %4
%10 = call i32 (...) @create()
br label %21
11: ; preds = %4
%12 = call i32 (...) @insert()
br label %21
13: ; preds = %4
%14 = call i32 (...) @display()
br label %21
15: ; preds = %4
%16 = call i32 (...) @delete()
br label %21
17: ; preds = %4
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %4
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %21
21: ; preds = %19, %15, %13, %11, %9
br label %4
}