#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 */
struct Stack *createStack(int);
int isEmpty(struct Stack *);
int peek(struct Stack *);
int pop(struct Stack *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ push(struct Stack *, int);
int main() {
  struct Stack *stack = createStack(100);
  printf("Is empty: %d\n", isEmpty(stack));
  push(stack, 4);
  push(stack, 7);
  push(stack, 9);
  printf("Top: %d\n", peek(stack));
  printf("Popped: %d\n", pop(stack));
  printf("Top: %d\n", peek(stack));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1060 <createStack@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <isEmpty@plt>
mov    %eax,%esi
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1080 <push@plt>
mov    -0x8(%rbp),%rdi
mov    $0x7,%esi
call   1080 <push@plt>
mov    -0x8(%rbp),%rdi
mov    $0x9,%esi
call   1080 <push@plt>
mov    -0x8(%rbp),%rdi
call   1030 <peek@plt>
mov    %eax,%esi
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <peek@plt>
mov    %eax,%esi
lea    0xe17(%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    $0x64,%edi
call   1060 <createStack@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <isEmpty@plt>
lea    0xe80(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1080 <push@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1080 <push@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1080 <push@plt>
mov    %rbx,%rdi
call   1030 <peek@plt>
lea    0xe51(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <pop@plt>
lea    0xe41(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <peek@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.Stack = type { i32 }
@.str = [14 x i8] c"Is empty: %d\0A\00"
@.str.1 = [9 x i8] c"Top: %d\0A\00"
@.str.2 = [12 x i8] c"Popped: %d\0A\00"
define i32 @main() {
%1 = alloca %struct.Stack*
%2 = call %struct.Stack* @createStack(i32 100)
store %struct.Stack* %2, %struct.Stack** %1
%3 = load %struct.Stack*, %struct.Stack** %1
%4 = call i32 @isEmpty(%struct.Stack* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load %struct.Stack*, %struct.Stack** %1
%7 = call i32 @push(%struct.Stack* %6, i32 4)
%8 = load %struct.Stack*, %struct.Stack** %1
%9 = call i32 @push(%struct.Stack* %8, i32 7)
%10 = load %struct.Stack*, %struct.Stack** %1
%11 = call i32 @push(%struct.Stack* %10, i32 9)
%12 = load %struct.Stack*, %struct.Stack** %1
%13 = call i32 @peek(%struct.Stack* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load %struct.Stack*, %struct.Stack** %1
%16 = call i32 @pop(%struct.Stack* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = load %struct.Stack*, %struct.Stack** %1
%19 = call i32 @peek(%struct.Stack* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
%struct.Stack = type { i32 }
@.str = [14 x i8] c"Is empty: %d\0A\00"
@.str.1 = [9 x i8] c"Top: %d\0A\00"
@.str.2 = [12 x i8] c"Popped: %d\0A\00"
define i32 @main() {
%1 = tail call %struct.Stack* @createStack(i32 100)
%2 = tail call i32 @isEmpty(%struct.Stack* %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @push(%struct.Stack* %1, i32 4)
%5 = tail call i32 @push(%struct.Stack* %1, i32 7)
%6 = tail call i32 @push(%struct.Stack* %1, i32 9)
%7 = tail call i32 @peek(%struct.Stack* %1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 @pop(%struct.Stack* %1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = tail call i32 @peek(%struct.Stack* %1)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}