#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*/ get_top();
int /*<<< orphan*/ pop();
int /*<<< orphan*/ print_stack();
int /*<<< orphan*/ push(int);
int rand();
int main() {
  push(rand() % 10);
  pop();
  pop();
  push(rand() % 10);
  print_stack();
  push(rand() % 10);
  print_stack();
  push(rand() % 10);
  print_stack();
  push(rand() % 10);
  get_top();
  push(rand() % 10);
  print_stack();
  pop();
  pop();
  print_stack();
  push(rand() % 10);
  print_stack();
  get_top();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1030 <pop@plt>
mov    $0x0,%al
call   1030 <pop@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1050 <print_stack@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1050 <print_stack@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1050 <print_stack@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1040 <get_top@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1050 <print_stack@plt>
mov    $0x0,%al
call   1030 <pop@plt>
mov    $0x0,%al
call   1030 <pop@plt>
mov    $0x0,%al
call   1050 <print_stack@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1050 <print_stack@plt>
mov    $0x0,%al
call   1040 <get_top@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1030 <pop@plt>
xor    %eax,%eax
call   1030 <pop@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1050 <print_stack@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1050 <print_stack@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1050 <print_stack@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1040 <get_top@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1050 <print_stack@plt>
xor    %eax,%eax
call   1030 <pop@plt>
xor    %eax,%eax
call   1030 <pop@plt>
xor    %eax,%eax
call   1050 <print_stack@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1050 <print_stack@plt>
xor    %eax,%eax
call   1040 <get_top@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 10
%3 = call i32 @push(i32 %2)
%4 = call i32 (...) @pop()
%5 = call i32 (...) @pop()
%6 = call i32 (...) @rand()
%7 = srem i32 %6, 10
%8 = call i32 @push(i32 %7)
%9 = call i32 (...) @print_stack()
%10 = call i32 (...) @rand()
%11 = srem i32 %10, 10
%12 = call i32 @push(i32 %11)
%13 = call i32 (...) @print_stack()
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 10
%16 = call i32 @push(i32 %15)
%17 = call i32 (...) @print_stack()
%18 = call i32 (...) @rand()
%19 = srem i32 %18, 10
%20 = call i32 @push(i32 %19)
%21 = call i32 (...) @get_top()
%22 = call i32 (...) @rand()
%23 = srem i32 %22, 10
%24 = call i32 @push(i32 %23)
%25 = call i32 (...) @print_stack()
%26 = call i32 (...) @pop()
%27 = call i32 (...) @pop()
%28 = call i32 (...) @print_stack()
%29 = call i32 (...) @rand()
%30 = srem i32 %29, 10
%31 = call i32 @push(i32 %30)
%32 = call i32 (...) @print_stack()
%33 = call i32 (...) @get_top()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 10
%3 = tail call i32 @push(i32 %2)
%4 = tail call i32 (...) @pop()
%5 = tail call i32 (...) @pop()
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 10
%8 = tail call i32 @push(i32 %7)
%9 = tail call i32 (...) @print_stack()
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 10
%12 = tail call i32 @push(i32 %11)
%13 = tail call i32 (...) @print_stack()
%14 = tail call i32 (...) @rand()
%15 = srem i32 %14, 10
%16 = tail call i32 @push(i32 %15)
%17 = tail call i32 (...) @print_stack()
%18 = tail call i32 (...) @rand()
%19 = srem i32 %18, 10
%20 = tail call i32 @push(i32 %19)
%21 = tail call i32 (...) @get_top()
%22 = tail call i32 (...) @rand()
%23 = srem i32 %22, 10
%24 = tail call i32 @push(i32 %23)
%25 = tail call i32 (...) @print_stack()
%26 = tail call i32 (...) @pop()
%27 = tail call i32 (...) @pop()
%28 = tail call i32 (...) @print_stack()
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, 10
%31 = tail call i32 @push(i32 %30)
%32 = tail call i32 (...) @print_stack()
%33 = tail call i32 (...) @get_top()
ret i32 0
}