#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);
int /*<<< orphan*/ push(int);
int size();
int top();
int main() {
  push(5);
  push(10);
  push(15);
  push(12);
  printf("Top element = %d\n", top());
  printf("Size = %d\n", size());
  pop();
  printf("Top element = %d\n", top());
  printf("Size = %d\n", size());
  pop();
  pop();
  pop();
  printf("Top element = %d\n", top());
  printf("Size = %d\n", size());
  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    $0xa,%edi
call   1070 <push@plt>
mov    $0xf,%edi
call   1070 <push@plt>
mov    $0xc,%edi
call   1070 <push@plt>
mov    $0x0,%al
call   1060 <top@plt>
mov    %eax,%esi
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <size@plt>
mov    %eax,%esi
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    $0x0,%al
call   1060 <top@plt>
mov    %eax,%esi
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <size@plt>
mov    %eax,%esi
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    $0x0,%al
call   1060 <top@plt>
mov    %eax,%esi
lea    0xdf9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <size@plt>
mov    %eax,%esi
lea    0xdf6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x5,%edi
call   1070 <push@plt>
mov    $0xa,%edi
call   1070 <push@plt>
mov    $0xf,%edi
call   1070 <push@plt>
mov    $0xc,%edi
call   1070 <push@plt>
xor    %eax,%eax
call   1060 <top@plt>
lea    0xe76(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <size@plt>
lea    0xe70(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
xor    %eax,%eax
call   1060 <top@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <size@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
xor    %eax,%eax
call   1050 <pop@plt>
xor    %eax,%eax
call   1050 <pop@plt>
xor    %eax,%eax
call   1060 <top@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <size@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Top element = %d\0A\00"
@.str.1 = [11 x i8] c"Size = %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @push(i32 5)
%3 = call i32 @push(i32 10)
%4 = call i32 @push(i32 15)
%5 = call i32 @push(i32 12)
%6 = call i32 (...) @top()
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (...) @size()
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @pop()
%11 = call i32 (...) @top()
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 (...) @size()
%14 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = call i32 (...) @pop()
%16 = call i32 (...) @pop()
%17 = call i32 (...) @pop()
%18 = call i32 (...) @top()
%19 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 (...) @size()
%21 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Top element = %d\0A\00"
@.str.1 = [11 x i8] c"Size = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @push(i32 5)
%2 = tail call i32 @push(i32 10)
%3 = tail call i32 @push(i32 15)
%4 = tail call i32 @push(i32 12)
%5 = tail call i32 (...) @top()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @size()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 (...) @pop()
%10 = tail call i32 (...) @top()
%11 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 (...) @size()
%13 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 (...) @pop()
%15 = tail call i32 (...) @pop()
%16 = tail call i32 (...) @pop()
%17 = tail call i32 (...) @top()
%18 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = tail call i32 (...) @size()
%20 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %19)
ret i32 0
}