#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*/ display();
int /*<<< orphan*/ pop();
int /*<<< orphan*/ popall();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push();
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int a;
  do {
    printf("Enter choice");
    scanf("%d", &a);
    switch (a) {
    case 1:
      push();
      break;
    case 2:
      pop();
      break;
    case 3:
      display();
      break;
    case 4:
      popall();
      printf("EXIT");
      break;
    }
  } while (a != 4);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11e4 <main+0x84>
mov    -0x10(%rbp),%rax
lea    0xe5c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <push@plt>
jmp    11e4 <main+0x84>
mov    $0x0,%al
call   1050 <pop@plt>
jmp    11e4 <main+0x84>
mov    $0x0,%al
call   1030 <display@plt>
jmp    11e4 <main+0x84>
mov    $0x0,%al
call   1080 <popall@plt>
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
jmp    11e9 <main+0x89>
cmpl   $0x4,-0x4(%rbp)
jne    1168 <main+0x8>
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    0xe9c(%rip),%r14
lea    0xea2(%rip),%r15
lea    0xc(%rsp),%r13
lea    0xe79(%rip),%rbx
lea    0xe92(%rip),%r12
jmp    11a8 <main+0x48>
xor    %eax,%eax
call   1080 <popall@plt>
mov    %r12,%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
cmp    $0x4,%eax
je     11f9 <main+0x99>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x3,%ecx
ja     11a3 <main+0x43>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <push@plt>
jmp    119f <main+0x3f>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <pop@plt>
jmp    119f <main+0x3f>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <display@plt>
jmp    119f <main+0x3f>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Enter choice\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"EXIT\00"
define void @main() {
%1 = alloca i32
br label %2
2: ; preds = %16, %0
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %15 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
]
6: ; preds = %2
%7 = call i32 (...) @push()
br label %15
8: ; preds = %2
%9 = call i32 (...) @pop()
br label %15
10: ; preds = %2
%11 = call i32 (...) @display()
br label %15
12: ; preds = %2
%13 = call i32 (...) @popall()
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %2, %12, %10, %8, %6
br label %16
16: ; preds = %15
%17 = load i32, i32* %1
%18 = icmp ne i32 %17, 4
br i1 %18, label %2, label %19
19: ; preds = %16
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Enter choice\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"EXIT\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %18, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 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 %18 [
i32 1, label %7
i32 2, label %9
i32 3, label %11
i32 4, label %13
]
7: ; preds = %3
%8 = call i32 (...) @push()
br label %16
9: ; preds = %3
%10 = call i32 (...) @pop()
br label %16
11: ; preds = %3
%12 = call i32 (...) @display()
br label %16
13: ; preds = %3
%14 = call i32 (...) @popall()
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %13, %11, %9, %7
%17 = load i32, i32* %1
br label %18
18: ; preds = %16, %3
%19 = phi i32 [ %17, %16 ], [ %6, %3 ]
%20 = icmp eq i32 %19, 4
br i1 %20, label %21, label %3
21: ; preds = %18
ret void
}