#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 *);
int main() {
  int choice;
  printf("Enter operation # -\nYou have the following choices:\n");
  printf("1. Push\n2. Pop\n3.exit\n");
  do {
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      push();
      break;
    case 2:
      pop();
      break;
    case 3:
      break;
    }
  } while (choice != 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    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xede(%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    11ca <main+0x8a>
mov    $0x0,%al
call   1040 <pop@plt>
jmp    11ca <main+0x8a>
jmp    11ca <main+0x8a>
jmp    11cf <main+0x8f>
cmpl   $0x3,-0x8(%rbp)
jne    1167 <main+0x27>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9d(%rip),%r14
lea    0x4(%rsp),%rbx
jmp    1180 <main+0x40>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <pop@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     11a2 <main+0x62>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
je     1170 <main+0x30>
cmp    $0x1,%eax
jne    117b <main+0x3b>
xor    %eax,%eax
call   1060 <push@plt>
jmp    1177 <main+0x37>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Enter operation # -\0AYou have the following choices:\0A\00"
@.str.1 = [23 x i8] c"1. Push\0A2. Pop\0A3.exit\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %14, %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 = %5
%9 = call i32 (...) @push()
br label %13
10: ; preds = %5
%11 = call i32 (...) @pop()
br label %13
12: ; preds = %5
br label %13
13: ; preds = %5, %12, %10, %8
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 3
br i1 %16, label %5, label %17
17: ; preds = %14
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@str = [52 x i8] c"Enter operation # -\0AYou have the following choices:\00"
@str.3 = [22 x i8] c"1. Push\0A2. Pop\0A3.exit\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
br label %5
5: ; preds = %14, %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 %14 [
i32 1, label %8
i32 2, label %10
]
8: ; preds = %5
%9 = call i32 (...) @push()
br label %12
10: ; preds = %5
%11 = call i32 (...) @pop()
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* %1
br label %14
14: ; preds = %12, %5
%15 = phi i32 [ %13, %12 ], [ %7, %5 ]
%16 = icmp eq i32 %15, 3
br i1 %16, label %17, label %5
17: ; preds = %14
ret i32 0
}