#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 min();
int peek();
int pop();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ push(int);
int main(void) {
  push(100);
  push(200);
  printf("Expected min value: 100, actual is: %i\n", min());
  printf("Expected pop: 200, actual: %i\n", pop());
  printf("Expected peek: 100, actual: %i\n", peek());
  push(1);
  printf("Expected min: 1, actual: %i\n", min());
  int value;
  do {
    value = pop();
    printf("Current value: %i\n", value);
  } while (value != -99999);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%edi
call   1070 <push@plt>
mov    $0xc8,%edi
call   1070 <push@plt>
mov    $0x0,%al
call   1050 <min@plt>
mov    %eax,%esi
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <pop@plt>
mov    %eax,%esi
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <peek@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <push@plt>
mov    $0x0,%al
call   1050 <min@plt>
mov    %eax,%esi
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <pop@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0xfffe7961,-0x8(%rbp)
jne    11d1 <main+0x81>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x64,%edi
call   1070 <push@plt>
mov    $0xc8,%edi
call   1070 <push@plt>
xor    %eax,%eax
call   1050 <min@plt>
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <pop@plt>
lea    0xe9e(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <peek@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <push@plt>
xor    %eax,%eax
call   1050 <min@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xeb8(%rip),%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <pop@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
cmp    $0xfffe7961,%ebp
jne    11d0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Expected min value: 100, actual is: %i\0A\00"
@.str.1 = [31 x i8] c"Expected pop: 200, actual: %i\0A\00"
@.str.2 = [32 x i8] c"Expected peek: 100, actual: %i\0A\00"
@.str.3 = [29 x i8] c"Expected min: 1, actual: %i\0A\00"
@.str.4 = [19 x i8] c"Current value: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @push(i32 100)
%4 = call i32 @push(i32 200)
%5 = call i32 (...) @min()
%6 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @pop()
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 (...) @peek()
%10 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = call i32 @push(i32 1)
%12 = call i32 (...) @min()
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %18, %0
%15 = call i32 (...) @pop()
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14
%19 = load i32, i32* %2
%20 = icmp ne i32 %19, -99999
br i1 %20, label %14, label %21
21: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"Expected min value: 100, actual is: %i\0A\00"
@.str.1 = [31 x i8] c"Expected pop: 200, actual: %i\0A\00"
@.str.2 = [32 x i8] c"Expected peek: 100, actual: %i\0A\00"
@.str.3 = [29 x i8] c"Expected min: 1, actual: %i\0A\00"
@.str.4 = [19 x i8] c"Current value: %i\0A\00"
define i32 @main() {
%1 = tail call i32 @push(i32 100)
%2 = tail call i32 @push(i32 200)
%3 = tail call i32 (...) @min()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @pop()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 (...) @peek()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @push(i32 1)
%10 = tail call i32 (...) @min()
%11 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %12, %0
%13 = tail call i32 (...) @pop()
%14 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %13, -99999
br i1 %15, label %16, label %12
16: ; preds = %12
ret i32 0
}