#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*/ DisplayMenu();
int /*<<< orphan*/ DisplayStack(int *, int);
int /*<<< orphan*/ Palindrome(int);
int Pop(int *, int *);
int /*<<< orphan*/ Push(int *, int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int arr[100], top = -1, choice, elem, num, exit = 0;
  DisplayMenu();
  while (1) {
    printf("Enter choice : ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      printf("Enter an element : ");
      scanf("%d", &elem);
      Push(arr, &top, elem);
      break;
    case 2:
      elem = Pop(arr, &top);
      if (elem != -9999) {
        printf("The element popped out : %d\n", elem);
      }
      break;
    case 3:
      printf("The stack is : \n");
      DisplayStack(arr, top);
      break;
    case 4:
      printf("Enter A Number : ");
      scanf("%d", &num);
      Palindrome(num);
      break;
    case 5:
      exit = 1;
      break;
    default:
      printf("Wrong Choice. Try again.\n");
    }
    if (exit == 1) {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x1a4(%rbp)
ff ff ff
movl   $0x0,-0x1b4(%rbp)
mov    $0x0,%al
call   1050 <DisplayMenu@plt>
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
lea    -0x1a8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x1a8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x1c0(%rbp)
sub    $0x4,%eax
ja     12d6 <main+0x166>
mov    -0x1c0(%rbp),%rax
lea    0xe19(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1f(%rip),%rdi
lea    -0x1ac(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1ac(%rbp),%edx
lea    -0x1a4(%rbp),%rsi
call   1060 <Push@plt>
jmp    12e4 <main+0x174>
lea    -0x1a0(%rbp),%rdi
lea    -0x1a4(%rbp),%rsi
call   1040 <Pop@plt>
mov    %eax,-0x1ac(%rbp)
cmpl   $0xffffd8f1,-0x1ac(%rbp)
d8 ff ff
je     126c <main+0xfc>
mov    -0x1ac(%rbp),%esi
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e4 <main+0x174>
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
call   1090 <DisplayStack@plt>
jmp    12e4 <main+0x174>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd79(%rip),%rdi
lea    -0x1b0(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x1b0(%rbp),%edi
call   1080 <Palindrome@plt>
jmp    12e4 <main+0x174>
movl   $0x1,-0x1b4(%rbp)
jmp    12e4 <main+0x174>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x1b4(%rbp)
jne    12f6 <main+0x186>
jmp    12fb <main+0x18b>
jmp    119d <main+0x2d>
mov    -0x4(%rbp),%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
movl   $0xffffffff,0x4(%rsp)
ff
xor    %eax,%eax
call   1060 <DisplayMenu@plt>
lea    0xe6d(%rip),%r14
lea    0xe76(%rip),%rbx
lea    0xc(%rsp),%r15
lea    0xe46(%rip),%rbp
lea    0x10(%rsp),%r12
lea    0x4(%rsp),%r13
jmp    11f0 <main+0x70>
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x8(%rsp),%edi
call   1090 <Palindrome@plt>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x4,%eax
ja     1244 <main+0xc4>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
lea    0xe05(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rsp,%rsi
call   1080 <scanf@plt>
mov    (%rsp),%edx
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <Push@plt>
jmp    11f0 <main+0x70>
lea    0xe2f(%rip),%rdi
call   1030 <puts@plt>
jmp    11f0 <main+0x70>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <Pop@plt>
mov    %eax,(%rsp)
cmp    $0xffffd8f1,%eax
je     11f0 <main+0x70>
lea    0xdcd(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f0 <main+0x70>
lea    0xde7(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%esi
mov    %r12,%rdi
call   10a0 <DisplayStack@plt>
jmp    11f0 <main+0x70>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter choice : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Enter an element : \00"
@.str.3 = [29 x i8] c"The element popped out : %d\0A\00"
@.str.4 = [17 x i8] c"The stack is : \0A\00"
@.str.5 = [18 x i8] c"Enter A Number : \00"
@.str.6 = [26 x i8] c"Wrong Choice. Try again.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %3
store i32 0, i32* %7
%8 = call i32 (...) @DisplayMenu()
br label %9
9: ; preds = %0, %45
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %4
switch i32 %12, label %39 [
i32 1, label %13
i32 2, label %19
i32 3, label %28
i32 4, label %33
i32 5, label %38
]
13: ; preds = %9
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%17 = load i32, i32* %5
%18 = call i32 @Push(i32* %16, i32* %3, i32 %17)
br label %41
19: ; preds = %9
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%21 = call i32 @Pop(i32* %20, i32* %3)
store i32 %21, i32* %5
%22 = load i32, i32* %5
%23 = icmp ne i32 %22, -9999
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i32, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %24, %19
br label %41
28: ; preds = %9
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%30 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%31 = load i32, i32* %3
%32 = call i32 @DisplayStack(i32* %30, i32 %31)
br label %41
33: ; preds = %9
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%36 = load i32, i32* %6
%37 = call i32 @Palindrome(i32 %36)
br label %41
38: ; preds = %9
store i32 1, i32* %7
br label %41
39: ; preds = %9
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %39, %38, %33, %28, %27, %13
%42 = load i32, i32* %7
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %45
44: ; preds = %41
br label %46
45: ; preds = %41
br label %9
46: ; preds = %44
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [16 x i8] c"Enter choice : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Enter an element : \00"
@.str.3 = [29 x i8] c"The element popped out : %d\0A\00"
@.str.5 = [18 x i8] c"Enter A Number : \00"
@str = [16 x i8] c"The stack is : \00"
@str.7 = [25 x i8] c"Wrong Choice. Try again.\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [100 x i32]* %1 to i8*
%7 = bitcast i32* %2 to i8*
store i32 -1, i32* %2
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = tail call i32 (...) @DisplayMenu()
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
br label %13
13: ; preds = %27, %0
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
switch i32 %16, label %37 [
i32 1, label %17
i32 2, label %22
i32 3, label %28
i32 4, label %32
i32 5, label %39
]
17: ; preds = %13
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%20 = load i32, i32* %4
%21 = call i32 @Push(i32* %12, i32* %2, i32 %20)
br label %27
22: ; preds = %13
%23 = call i32 @Pop(i32* %12, i32* %2)
store i32 %23, i32* %4
%24 = icmp eq i32 %23, -9999
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %23)
br label %27
27: ; preds = %25, %37, %32, %28, %17, %22
br label %13
28: ; preds = %13
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%30 = load i32, i32* %2
%31 = call i32 @DisplayStack(i32* %12, i32 %30)
br label %27
32: ; preds = %13
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%35 = load i32, i32* %5
%36 = call i32 @Palindrome(i32 %35)
br label %27
37: ; preds = %13
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
br label %27
39: ; preds = %13
ret i32 0
}