#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*/ pop1();
int /*<<< orphan*/ pop2();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ push1();
int /*<<< orphan*/ push2();
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int n;
  do {
    printf("\nPush in Stack 1\n");
    printf("Push in stack 2\n");
    printf("Pop from stack 1\n");
    printf("Pop from stack 2\n");
    printf("Display both Stack\n");
    printf("Exit\n");
    scanf("%d", &n);
    switch (n) {
    case 1: {
      push1();
      break;
    }
    case 2: {
      push2();
      break;
    }
    case 3: {
      pop1();
      break;
    }
    case 4: {
      pop2();
      break;
    }
    case 5: {
      display();
      break;
    }
    case 6: {
      break;
    }
    }
  } while (n != 6);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
lea    0xea4(%rip),%rdi
call   1050 <printf@plt>
lea    0xeaa(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb2(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5,%eax
ja     123a <main+0xca>
mov    -0x10(%rbp),%rax
lea    0xe10(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1080 <push1@plt>
jmp    123a <main+0xca>
mov    $0x0,%al
call   1030 <push2@plt>
jmp    123a <main+0xca>
mov    $0x0,%al
call   1090 <pop1@plt>
jmp    123a <main+0xca>
mov    $0x0,%al
call   1060 <pop2@plt>
jmp    123a <main+0xca>
mov    $0x0,%al
call   1040 <display@plt>
jmp    123a <main+0xca>
jmp    123a <main+0xca>
jmp    123f <main+0xcf>
cmpl   $0x6,-0x4(%rbp)
jne    1178 <main+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xec7(%rip),%r13
lea    0xed1(%rip),%rbx
lea    0xedd(%rip),%rbp
lea    0xe7d(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe5d(%rip),%r12
jmp    11bd <main+0x4d>
xor    %eax,%eax
call   1050 <display@plt>
nopl   0x0(%rax)
mov    0x4(%rsp),%eax
cmp    $0x6,%eax
je     1243 <main+0xd3>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x4,%ecx
ja     11b4 <main+0x44>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   1080 <push1@plt>
jmp    11b0 <main+0x40>
xor    %eax,%eax
call   1040 <push2@plt>
jmp    11b0 <main+0x40>
xor    %eax,%eax
call   1090 <pop1@plt>
jmp    11b0 <main+0x40>
xor    %eax,%eax
call   1060 <pop2@plt>
jmp    11b0 <main+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\0APush in Stack 1\0A\00"
@.str.1 = [17 x i8] c"Push in stack 2\0A\00"
@.str.2 = [18 x i8] c"Pop from stack 1\0A\00"
@.str.3 = [18 x i8] c"Pop from stack 2\0A\00"
@.str.4 = [20 x i8] c"Display both Stack\0A\00"
@.str.5 = [6 x i8] c"Exit\0A\00"
@.str.6 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
br label %2
2: ; preds = %23, %0
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
switch i32 %10, label %22 [
i32 1, label %11
i32 2, label %13
i32 3, label %15
i32 4, label %17
i32 5, label %19
i32 6, label %21
]
11: ; preds = %2
%12 = call i32 (...) @push1()
br label %22
13: ; preds = %2
%14 = call i32 (...) @push2()
br label %22
15: ; preds = %2
%16 = call i32 (...) @pop1()
br label %22
17: ; preds = %2
%18 = call i32 (...) @pop2()
br label %22
19: ; preds = %2
%20 = call i32 (...) @display()
br label %22
21: ; preds = %2
br label %22
22: ; preds = %2, %21, %19, %17, %15, %13, %11
br label %23
23: ; preds = %22
%24 = load i32, i32* %1
%25 = icmp ne i32 %24, 6
br i1 %25, label %2, label %26
26: ; preds = %23
ret void
}

LLVM IR (-O2):
@.str.6 = [3 x i8] c"%d\00"
@str = [17 x i8] c"\0APush in Stack 1\00"
@str.7 = [16 x i8] c"Push in stack 2\00"
@str.8 = [17 x i8] c"Pop from stack 1\00"
@str.9 = [17 x i8] c"Pop from stack 2\00"
@str.10 = [19 x i8] c"Display both Stack\00"
@str.11 = [5 x i8] c"Exit\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %24, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.7, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.11, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
switch i32 %11, label %24 [
i32 1, label %12
i32 2, label %14
i32 3, label %16
i32 4, label %18
i32 5, label %20
]
12: ; preds = %3
%13 = call i32 (...) @push1()
br label %22
14: ; preds = %3
%15 = call i32 (...) @push2()
br label %22
16: ; preds = %3
%17 = call i32 (...) @pop1()
br label %22
18: ; preds = %3
%19 = call i32 (...) @pop2()
br label %22
20: ; preds = %3
%21 = call i32 (...) @display()
br label %22
22: ; preds = %20, %18, %16, %14, %12
%23 = load i32, i32* %1
br label %24
24: ; preds = %22, %3
%25 = phi i32 [ %23, %22 ], [ %11, %3 ]
%26 = icmp eq i32 %25, 6
br i1 %26, label %27, label %3
27: ; preds = %24
ret void
}