#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 peek();
int pop();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ push(int);
int /*<<< orphan*/ test();
int main(int argc, char **argv) {
  int ret = 0;
  test();
  push(1);
  push(2);
  push(3);
  push(4);
  push(5);
  push(6);
  push(7);
  push(8);
  printf("peek: %d\n", peek());
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  push(70);
  push(80);
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  printf("pop : %d\n", pop());
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1070 <test@plt>
mov    $0x1,%edi
call   1060 <push@plt>
mov    $0x2,%edi
call   1060 <push@plt>
mov    $0x3,%edi
call   1060 <push@plt>
mov    $0x4,%edi
call   1060 <push@plt>
mov    $0x5,%edi
call   1060 <push@plt>
mov    $0x6,%edi
call   1060 <push@plt>
mov    $0x7,%edi
call   1060 <push@plt>
mov    $0x8,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1030 <peek@plt>
mov    %eax,%esi
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xe0c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xdf7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xde2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xdcd(%rip),%rdi
call   1040 <printf@plt>
mov    $0x46,%edi
call   1060 <push@plt>
mov    $0x50,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xda4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xd8f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xd7a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xd65(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xd50(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xd3b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1070 <test@plt>
mov    $0x1,%edi
call   1060 <push@plt>
mov    $0x2,%edi
call   1060 <push@plt>
mov    $0x3,%edi
call   1060 <push@plt>
mov    $0x4,%edi
call   1060 <push@plt>
mov    $0x5,%edi
call   1060 <push@plt>
mov    $0x6,%edi
call   1060 <push@plt>
mov    $0x7,%edi
call   1060 <push@plt>
mov    $0x8,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1030 <peek@plt>
lea    0xe4a(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
lea    0xe3f(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x46,%edi
call   1060 <push@plt>
mov    $0x50,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"peek: %d\0A\00"
@.str.1 = [10 x i8] c"pop : %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i32 (...) @test()
%8 = call i32 @push(i32 1)
%9 = call i32 @push(i32 2)
%10 = call i32 @push(i32 3)
%11 = call i32 @push(i32 4)
%12 = call i32 @push(i32 5)
%13 = call i32 @push(i32 6)
%14 = call i32 @push(i32 7)
%15 = call i32 @push(i32 8)
%16 = call i32 (...) @peek()
%17 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 (...) @pop()
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 (...) @pop()
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 (...) @pop()
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 (...) @pop()
%25 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 (...) @pop()
%27 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = call i32 @push(i32 70)
%29 = call i32 @push(i32 80)
%30 = call i32 (...) @pop()
%31 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = call i32 (...) @pop()
%33 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = call i32 (...) @pop()
%35 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = call i32 (...) @pop()
%37 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = call i32 (...) @pop()
%39 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = call i32 (...) @pop()
%41 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %6
ret i32 %42
}

LLVM IR (-O2):
@.str = [10 x i8] c"peek: %d\0A\00"
@.str.1 = [10 x i8] c"pop : %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test()
%4 = tail call i32 @push(i32 1)
%5 = tail call i32 @push(i32 2)
%6 = tail call i32 @push(i32 3)
%7 = tail call i32 @push(i32 4)
%8 = tail call i32 @push(i32 5)
%9 = tail call i32 @push(i32 6)
%10 = tail call i32 @push(i32 7)
%11 = tail call i32 @push(i32 8)
%12 = tail call i32 (...) @peek()
%13 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = tail call i32 (...) @pop()
%15 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = tail call i32 (...) @pop()
%17 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = tail call i32 (...) @pop()
%19 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = tail call i32 (...) @pop()
%21 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = tail call i32 (...) @pop()
%23 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = tail call i32 @push(i32 70)
%25 = tail call i32 @push(i32 80)
%26 = tail call i32 (...) @pop()
%27 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = tail call i32 (...) @pop()
%29 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = tail call i32 (...) @pop()
%31 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = tail call i32 (...) @pop()
%33 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = tail call i32 (...) @pop()
%35 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = tail call i32 (...) @pop()
%37 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %36)
ret i32 0
}