#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 SimpleArrayStack {
  int dummy;
};

/* Variables and functions */
struct SimpleArrayStack *CreateStack();
int /*<<< orphan*/ DeleteStack(struct SimpleArrayStack *);
int /*<<< orphan*/ IsEmptyStack(struct SimpleArrayStack *);
int Pop(struct SimpleArrayStack *);
int /*<<< orphan*/ Push(struct SimpleArrayStack *, int);
int /*<<< orphan*/ printf(char *, int);
void testSimpleArrayStack() {
  struct SimpleArrayStack *s = CreateStack();
  Push(s, 10);
  Push(s, 1);
  Push(s, 11);
  Push(s, 2);
  Push(s, 10);
  Push(s, 50);
  while (!IsEmptyStack(s)) {
    printf("%d\n", Pop(s));
  }
  DeleteStack(s);
}


x86 assembly (clang, -O0):
<testSimpleArrayStack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <CreateStack@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1060 <Push@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1060 <Push@plt>
mov    -0x8(%rbp),%rdi
mov    $0xb,%esi
call   1060 <Push@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1060 <Push@plt>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1060 <Push@plt>
mov    -0x8(%rbp),%rdi
mov    $0x32,%esi
call   1060 <Push@plt>
mov    -0x8(%rbp),%rdi
call   1070 <IsEmptyStack@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e5 <testSimpleArrayStack+0x85>
jmp    1201 <testSimpleArrayStack+0xa1>
mov    -0x8(%rbp),%rdi
call   1040 <Pop@plt>
mov    %eax,%esi
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
jmp    11c7 <testSimpleArrayStack+0x67>
mov    -0x8(%rbp),%rdi
call   1080 <DeleteStack@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testSimpleArrayStack>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <CreateStack@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
call   1060 <Push@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <Push@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1060 <Push@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <Push@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <Push@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1060 <Push@plt>
mov    %rbx,%rdi
call   1070 <IsEmptyStack@plt>
test   %eax,%eax
jne    11ee <testSimpleArrayStack+0x8e>
lea    0xe31(%rip),%r14
nop
mov    %rbx,%rdi
call   1040 <Pop@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1070 <IsEmptyStack@plt>
test   %eax,%eax
je     11d0 <testSimpleArrayStack+0x70>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1080 <DeleteStack@plt>

LLVM IR (-O0):
%struct.SimpleArrayStack = type { i32 }
@.str = [4 x i8] c"%d\0A\00"
define void @testSimpleArrayStack() {
%1 = alloca %struct.SimpleArrayStack*
%2 = call %struct.SimpleArrayStack* (...) @CreateStack()
store %struct.SimpleArrayStack* %2, %struct.SimpleArrayStack** %1
%3 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%4 = call i32 @Push(%struct.SimpleArrayStack* %3, i32 10)
%5 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%6 = call i32 @Push(%struct.SimpleArrayStack* %5, i32 1)
%7 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%8 = call i32 @Push(%struct.SimpleArrayStack* %7, i32 11)
%9 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%10 = call i32 @Push(%struct.SimpleArrayStack* %9, i32 2)
%11 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%12 = call i32 @Push(%struct.SimpleArrayStack* %11, i32 10)
%13 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%14 = call i32 @Push(%struct.SimpleArrayStack* %13, i32 50)
br label %15
15: ; preds = %20, %0
%16 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%17 = call i32 @IsEmptyStack(%struct.SimpleArrayStack* %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%22 = call i32 @Pop(%struct.SimpleArrayStack* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
br label %15
24: ; preds = %15
%25 = load %struct.SimpleArrayStack*, %struct.SimpleArrayStack** %1
%26 = call i32 @DeleteStack(%struct.SimpleArrayStack* %25)
ret void
}

LLVM IR (-O2):
%struct.SimpleArrayStack = type { i32 }
@.str = [4 x i8] c"%d\0A\00"
define void @testSimpleArrayStack() {
%1 = tail call %struct.SimpleArrayStack* (...) @CreateStack()
%2 = tail call i32 @Push(%struct.SimpleArrayStack* %1, i32 10)
%3 = tail call i32 @Push(%struct.SimpleArrayStack* %1, i32 1)
%4 = tail call i32 @Push(%struct.SimpleArrayStack* %1, i32 11)
%5 = tail call i32 @Push(%struct.SimpleArrayStack* %1, i32 2)
%6 = tail call i32 @Push(%struct.SimpleArrayStack* %1, i32 10)
%7 = tail call i32 @Push(%struct.SimpleArrayStack* %1, i32 50)
%8 = tail call i32 @IsEmptyStack(%struct.SimpleArrayStack* %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %0, %10
%11 = tail call i32 @Pop(%struct.SimpleArrayStack* %1)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 @IsEmptyStack(%struct.SimpleArrayStack* %1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %10, label %15
15: ; preds = %10, %0
%16 = tail call i32 @DeleteStack(%struct.SimpleArrayStack* %1)
ret void
}