#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 */
struct Stack {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ peek(struct Stack *);
int /*<<< orphan*/ pop(struct Stack **);
int /*<<< orphan*/ push(struct Stack **, int);
int main() {
  struct Stack *stack = NULL;
  push(&stack, 4);
  push(&stack, 7);
  push(&stack, 9);
  peek(stack);
  pop(&stack);
  peek(stack);
  push(&stack, 1);
  pop(&stack);
  pop(&stack);
  pop(&stack);
  peek(stack);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1050 <push@plt>
lea    -0x8(%rbp),%rdi
mov    $0x7,%esi
call   1050 <push@plt>
lea    -0x8(%rbp),%rdi
mov    $0x9,%esi
call   1050 <push@plt>
mov    -0x8(%rbp),%rdi
call   1030 <peek@plt>
lea    -0x8(%rbp),%rdi
call   1040 <pop@plt>
mov    -0x8(%rbp),%rdi
call   1030 <peek@plt>
lea    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1050 <push@plt>
lea    -0x8(%rbp),%rdi
call   1040 <pop@plt>
lea    -0x8(%rbp),%rdi
call   1040 <pop@plt>
lea    -0x8(%rbp),%rdi
call   1040 <pop@plt>
mov    -0x8(%rbp),%rdi
call   1030 <peek@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1050 <push@plt>
mov    0x8(%rsp),%rdi
call   1030 <peek@plt>
mov    %rbx,%rdi
call   1040 <pop@plt>
mov    0x8(%rsp),%rdi
call   1030 <peek@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
call   1040 <pop@plt>
mov    %rbx,%rdi
call   1040 <pop@plt>
mov    %rbx,%rdi
call   1040 <pop@plt>
mov    0x8(%rsp),%rdi
call   1030 <peek@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.Stack = type { i32 }
define i32 @main() {
%1 = alloca %struct.Stack*
store %struct.Stack* null, %struct.Stack** %1
%2 = call i32 @push(%struct.Stack** %1, i32 4)
%3 = call i32 @push(%struct.Stack** %1, i32 7)
%4 = call i32 @push(%struct.Stack** %1, i32 9)
%5 = load %struct.Stack*, %struct.Stack** %1
%6 = call i32 @peek(%struct.Stack* %5)
%7 = call i32 @pop(%struct.Stack** %1)
%8 = load %struct.Stack*, %struct.Stack** %1
%9 = call i32 @peek(%struct.Stack* %8)
%10 = call i32 @push(%struct.Stack** %1, i32 1)
%11 = call i32 @pop(%struct.Stack** %1)
%12 = call i32 @pop(%struct.Stack** %1)
%13 = call i32 @pop(%struct.Stack** %1)
%14 = load %struct.Stack*, %struct.Stack** %1
%15 = call i32 @peek(%struct.Stack* %14)
ret i32 0
}

LLVM IR (-O2):
%struct.Stack = type { i32 }
define i32 @main() {
%1 = alloca %struct.Stack*
%2 = bitcast %struct.Stack** %1 to i8*
store %struct.Stack* null, %struct.Stack** %1
%3 = call i32 @push(%struct.Stack** %1, i32 4)
%4 = call i32 @push(%struct.Stack** %1, i32 7)
%5 = call i32 @push(%struct.Stack** %1, i32 9)
%6 = load %struct.Stack*, %struct.Stack** %1
%7 = call i32 @peek(%struct.Stack* %6)
%8 = call i32 @pop(%struct.Stack** %1)
%9 = load %struct.Stack*, %struct.Stack** %1
%10 = call i32 @peek(%struct.Stack* %9)
%11 = call i32 @push(%struct.Stack** %1, i32 1)
%12 = call i32 @pop(%struct.Stack** %1)
%13 = call i32 @pop(%struct.Stack** %1)
%14 = call i32 @pop(%struct.Stack** %1)
%15 = load %struct.Stack*, %struct.Stack** %1
%16 = call i32 @peek(%struct.Stack* %15)
ret i32 0
}