#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*/ clearstack();
double peek();
double pop();
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ push(int);
int /*<<< orphan*/ switchtoptwo();
main(void) {
  push(5);
  push(1);
  push(14);
  push(22);
  push(45);
  push(18);
  push(17);
  push(36);
  printf("%g\n", peek());
  printf("%g\n", peek());
  printf("%g\n", pop());
  printf("%g\n", peek());
  switchtoptwo();
  printf("%g\n", peek());
  switchtoptwo();
  printf("%g\n", peek());
  clearstack();
  printf("%g\n", peek());
  printf("%g\n", pop());
  switchtoptwo();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
call   1070 <push@plt>
mov    $0x1,%edi
call   1070 <push@plt>
mov    $0xe,%edi
call   1070 <push@plt>
mov    $0x16,%edi
call   1070 <push@plt>
mov    $0x2d,%edi
call   1070 <push@plt>
mov    $0x12,%edi
call   1070 <push@plt>
mov    $0x11,%edi
call   1070 <push@plt>
mov    $0x24,%edi
call   1070 <push@plt>
mov    $0x0,%al
call   1030 <peek@plt>
lea    0xe33(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <peek@plt>
lea    0xe20(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <pop@plt>
lea    0xe0d(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <peek@plt>
lea    0xdfa(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <switchtoptwo@plt>
mov    $0x0,%al
call   1030 <peek@plt>
lea    0xde0(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <switchtoptwo@plt>
mov    $0x0,%al
call   1030 <peek@plt>
lea    0xdc6(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <clearstack@plt>
mov    $0x0,%al
call   1030 <peek@plt>
lea    0xdac(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <pop@plt>
lea    0xd99(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <switchtoptwo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%edi
call   1070 <push@plt>
mov    $0x1,%edi
call   1070 <push@plt>
mov    $0xe,%edi
call   1070 <push@plt>
mov    $0x16,%edi
call   1070 <push@plt>
mov    $0x2d,%edi
call   1070 <push@plt>
mov    $0x12,%edi
call   1070 <push@plt>
mov    $0x11,%edi
call   1070 <push@plt>
mov    $0x24,%edi
call   1070 <push@plt>
xor    %eax,%eax
call   1030 <peek@plt>
lea    0xe41(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <peek@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <pop@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <peek@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <switchtoptwo@plt>
xor    %eax,%eax
call   1030 <peek@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <switchtoptwo@plt>
xor    %eax,%eax
call   1030 <peek@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <clearstack@plt>
xor    %eax,%eax
call   1030 <peek@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <pop@plt>
mov    %rbx,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <switchtoptwo@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @push(i32 5)
%3 = call i32 @push(i32 1)
%4 = call i32 @push(i32 14)
%5 = call i32 @push(i32 22)
%6 = call i32 @push(i32 45)
%7 = call i32 @push(i32 18)
%8 = call i32 @push(i32 17)
%9 = call i32 @push(i32 36)
%10 = call double (...) @peek()
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
%12 = call double (...) @peek()
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %12)
%14 = call double (...) @pop()
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %14)
%16 = call double (...) @peek()
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %16)
%18 = call i32 (...) @switchtoptwo()
%19 = call double (...) @peek()
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %19)
%21 = call i32 (...) @switchtoptwo()
%22 = call double (...) @peek()
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %22)
%24 = call i32 (...) @clearstack()
%25 = call double (...) @peek()
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %25)
%27 = call double (...) @pop()
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %27)
%29 = call i32 (...) @switchtoptwo()
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = tail call i32 @push(i32 5)
%2 = tail call i32 @push(i32 1)
%3 = tail call i32 @push(i32 14)
%4 = tail call i32 @push(i32 22)
%5 = tail call i32 @push(i32 45)
%6 = tail call i32 @push(i32 18)
%7 = tail call i32 @push(i32 17)
%8 = tail call i32 @push(i32 36)
%9 = tail call double (...) @peek()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %9)
%11 = tail call double (...) @peek()
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %11)
%13 = tail call double (...) @pop()
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %13)
%15 = tail call double (...) @peek()
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %15)
%17 = tail call i32 (...) @switchtoptwo()
%18 = tail call double (...) @peek()
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %18)
%20 = tail call i32 (...) @switchtoptwo()
%21 = tail call double (...) @peek()
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %21)
%23 = tail call i32 (...) @clearstack()
%24 = tail call double (...) @peek()
%25 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %24)
%26 = tail call double (...) @pop()
%27 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %26)
%28 = tail call i32 (...) @switchtoptwo()
ret i32 0
}