#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*/ pop();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push();
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int ch;
  do {
    printf("\n**MENU**\n1.PUSH an element:\n2.POP an element");
    printf("\n3.EXIT\nEnter your choice:");
    scanf("%d", &ch);
    switch (ch) {
    case 1:
      push();
      break;
    case 2:
      pop();
      break;
    case 3:
      break;
    default:
      printf("\nInvalid choice. Try again!!");
      break;
    }
  } while (ch != 3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11ad <main+0x6d>
jmp    118b <main+0x4b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11b9 <main+0x79>
jmp    119c <main+0x5c>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     11c5 <main+0x85>
jmp    11ca <main+0x8a>
mov    $0x0,%al
call   1060 <push@plt>
jmp    11d6 <main+0x96>
mov    $0x0,%al
call   1040 <pop@plt>
jmp    11d6 <main+0x96>
jmp    11d6 <main+0x96>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    11db <main+0x9b>
cmpl   $0x3,-0x8(%rbp)
jne    114f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeac(%rip),%r14
lea    0xed3(%rip),%r15
lea    0xee7(%rip),%r12
lea    0xc(%rsp),%rbx
lea    0xede(%rip),%r13
jmp    117e <main+0x3e>
xor    %eax,%eax
call   1040 <pop@plt>
cmpl   $0x3,0xc(%rsp)
je     11c9 <main+0x89>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     11c0 <main+0x80>
cmp    $0x2,%eax
je     1170 <main+0x30>
cmp    $0x3,%eax
je     11c9 <main+0x89>
mov    %r13,%rdi
call   1030 <printf@plt>
jmp    1177 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <push@plt>
jmp    1177 <main+0x37>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [46 x i8] c"\0A**MENU**\0A1.PUSH an element:\0A2.POP an element\00"
@.str.1 = [27 x i8] c"\0A3.EXIT\0AEnter your choice:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [29 x i8] c"\0AInvalid choice. Try again!!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %16, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
switch i32 %7, label %13 [
i32 1, label %8
i32 2, label %10
i32 3, label %12
]
8: ; preds = %3
%9 = call i32 (...) @push()
br label %15
10: ; preds = %3
%11 = call i32 (...) @pop()
br label %15
12: ; preds = %3
br label %15
13: ; preds = %3
%14 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %12, %10, %8
br label %16
16: ; preds = %15
%17 = load i32, i32* %2
%18 = icmp ne i32 %17, 3
br i1 %18, label %3, label %19
19: ; preds = %16
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [46 x i8] c"\0A**MENU**\0A1.PUSH an element:\0A2.POP an element\00"
@.str.1 = [27 x i8] c"\0A3.EXIT\0AEnter your choice:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [29 x i8] c"\0AInvalid choice. Try again!!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %14, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %12 [
i32 1, label %8
i32 2, label %10
i32 3, label %17
]
8: ; preds = %3
%9 = call i32 (...) @push()
br label %14
10: ; preds = %3
%11 = call i32 (...) @pop()
br label %14
12: ; preds = %3
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %8, %10, %12
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 3
br i1 %16, label %17, label %3
17: ; preds = %3, %14
ret i32 0
}