#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int option;
  while (1) {
    printf("############# Enter your option ########\n");
    printf("#1. Add a node to the linked list      #\n");
    printf("#2. Delete a node from the linked list #\n");
    printf("#3. Traverse a linked list             #\n");
    printf("#4. Quit this application              #\n");
    printf("#SLL>");
    scanf("%d", &option);
    switch (option) {
    case 1: {
      printf("\n\nAdding a node now\n");
      break;
    }
    case 2: {
      printf("\n\nDeleting a node now\n");
      break;
    }
    case 3: {
      printf("\n\nTraversing a Linked list now\n");
      break;
    }
    case 4: {
      printf("\n\nNothing to be done..quitting now\n");
      break;
    }
    default: {
      printf("\n\nInvalid option. Enter your option againa\n");
      break;
    }
    }
    if (option == 4)
      return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
call   1030 <printf@plt>
lea    0xf52(%rip),%rdi
call   1030 <printf@plt>
lea    0xf70(%rip),%rdi
call   1030 <printf@plt>
lea    0xf6a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11f4 <main+0xd4>
mov    -0x10(%rbp),%rax
lea    0xe59(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf34(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xe0>
lea    0xf38(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xe0>
lea    0xf3e(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xe0>
lea    0xf4d(%rip),%rdi
call   1030 <printf@plt>
jmp    1200 <main+0xe0>
lea    0xf60(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x4,-0x8(%rbp)
jne    1212 <main+0xf2>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf6b(%rip),%rbx
lea    0xeb7(%rip),%rbp
lea    0xeb6(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xfe6(%rip),%r12
lea    0x100d(%rip),%r13
jmp    117c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nop
call   1030 <puts@plt>
cmpl   $0x4,0x4(%rsp)
je     11e2 <main+0xb2>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
mov    %r12,%rdi
cmp    $0x3,%eax
ja     1170 <main+0x40>
cltq
movslq 0x0(%r13,%rax,4),%rdi
add    %r13,%rdi
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"############# Enter your option ########\0A\00"
@.str.1 = [42 x i8] c". Add a node to the linked list #\0A\00"
@.str.2 = [42 x i8] c". Delete a node from the linked list #\0A\00"
@.str.3 = [42 x i8] c". Traverse a linked list #\0A\00"
@.str.4 = [42 x i8] c". Quit this application #\0A\00"
@.str.5 = [6 x i8] c"#SLL>\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [21 x i8] c"\0A\0AAdding a node now\0A\00"
@.str.8 = [23 x i8] c"\0A\0ADeleting a node now\0A\00"
@.str.9 = [32 x i8] c"\0A\0ATraversing a Linked list now\0A\00"
@.str.10 = [36 x i8] c"\0A\0ANothing to be done..quitting now\0A\00"
@.str.11 = [44 x i8] c"\0A\0AInvalid option. Enter your option againa\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %26
%4 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
switch i32 %11, label %20 [
i32 1, label %12
i32 2, label %14
i32 3, label %16
i32 4, label %18
]
12: ; preds = %3
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %22
14: ; preds = %3
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %22
16: ; preds = %3
%17 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
br label %22
18: ; preds = %3
%19 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
br label %22
20: ; preds = %3
%21 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0))
br label %22
22: ; preds = %20, %18, %16, %14, %12
%23 = load i32, i32* %2
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %26
25: ; preds = %22
ret i32 0
26: ; preds = %22
br label %3
}

LLVM IR (-O2):
@.str.5 = [6 x i8] c"#SLL>\00"
@.str.6 = [3 x i8] c"%d\00"
@str = [41 x i8] c"############# Enter your option ########\00"
@str.12 = [41 x i8] c". Add a node to the linked list #\00"
@str.13 = [41 x i8] c". Delete a node from the linked list #\00"
@str.14 = [41 x i8] c". Traverse a linked list #\00"
@str.15 = [41 x i8] c". Quit this application #\00"
@str.16 = [35 x i8] c"\0A\0ANothing to be done..quitting now\00"
@str.17 = [31 x i8] c"\0A\0ATraversing a Linked list now\00"
@str.18 = [22 x i8] c"\0A\0ADeleting a node now\00"
@str.19 = [20 x i8] c"\0A\0AAdding a node now\00"
@str.20 = [43 x i8] c"\0A\0AInvalid option. Enter your option againa\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @str.19 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @str.18 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([31 x i8]* @str.17 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([35 x i8]* @str.16 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %18, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.12, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.13, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.14, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.15, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = add i32 %11, -1
%13 = icmp ult i32 %12, 4
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = sext i32 %12 to i64
%16 = shl i64 %15, 2
%17 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %16)
br label %18
18: ; preds = %3, %14
%19 = phi i8* [ %17, %14 ], [ getelementptr inbounds ([43 x i8], [43 x i8]* @str.20, i64 0, i64 0), %3 ]
%20 = call i32 @puts(i8* dereferenceable(1) %19)
%21 = load i32, i32* %1
%22 = icmp eq i32 %21, 4
br i1 %22, label %23, label %3
23: ; preds = %18
ret i32 0
}