#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stack_pop();
int /*<<< orphan*/ stack_push();
int /*<<< orphan*/ stack_size();
int /*<<< orphan*/ stdin;
int main() {
  for (;;) {
    int dis;
    printf("Enter your selection: \npress\n\t1.stack size\n\t2.stack "
           "pop\n\t3.stack push\n\t4.quit\n");
    scanf("%d", &dis);
    fflush(stdin);
    if (dis == 1)
      stack_size();
    else if (dis == 2)
      stack_pop();
    else if (dis == 3)
      stack_push();
    else
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11af <main+0x4f>
mov    $0x0,%al
call   1070 <stack_size@plt>
jmp    11ea <main+0x8a>
cmpl   $0x2,-0x8(%rbp)
jne    11c5 <main+0x65>
mov    $0x0,%al
call   1080 <stack_pop@plt>
jmp    11e5 <main+0x85>
cmpl   $0x3,-0x8(%rbp)
jne    11db <main+0x7b>
mov    $0x0,%al
call   1060 <stack_push@plt>
jmp    11e0 <main+0x80>
jmp    11ef <main+0x8f>
jmp    11e5 <main+0x85>
jmp    11ea <main+0x8a>
jmp    116f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe94(%rip),%r14
lea    0xe8a(%rip),%r15
lea    0x4(%rsp),%r12
mov    0x2e66(%rip),%rbx
jmp    1197 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1080 <stack_pop@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     11d0 <main+0x70>
cmp    $0x2,%eax
je     1190 <main+0x30>
cmp    $0x1,%eax
jne    11d9 <main+0x79>
xor    %eax,%eax
call   1070 <stack_size@plt>
jmp    1197 <main+0x37>
nopl   (%rax)
xor    %eax,%eax
call   1060 <stack_push@plt>
jmp    1197 <main+0x37>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [79 x i8] c"Enter your selection: \0Apress\0A\091.stack size\0A\092.stack pop\0A\093.stack push\0A\094.quit\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %25, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 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* %2)
%6 = load i32, i32* @stdin
%7 = call i32 @fflush(i32 %6)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 (...) @stack_size()
br label %25
12: ; preds = %3
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (...) @stack_pop()
br label %24
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (...) @stack_push()
br label %23
22: ; preds = %17
br label %26
23: ; preds = %20
br label %24
24: ; preds = %23, %15
br label %25
25: ; preds = %24, %10
br label %3
26: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
@str = [78 x i8] c"Enter your selection: \0Apress\0A\091.stack size\0A\092.stack pop\0A\093.stack push\0A\094.quit\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %15, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 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* @stdin
%7 = call i32 @fflush(i32 %6)
%8 = load i32, i32* %1
switch i32 %8, label %16 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
]
9: ; preds = %3
%10 = call i32 (...) @stack_size()
br label %15
11: ; preds = %3
%12 = call i32 (...) @stack_pop()
br label %15
13: ; preds = %3
%14 = call i32 (...) @stack_push()
br label %15
15: ; preds = %9, %13, %11
br label %3
16: ; preds = %3
ret i32 0
}