#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 *Stack_create(int);
int /*<<< orphan*/ Stack_delete(struct Stack *);
char *Stack_pop(struct Stack *);
int /*<<< orphan*/ Stack_push(struct Stack *, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  struct Stack *stack1 = Stack_create(5);
  Stack_push(stack1, "First");
  Stack_push(stack1, "Second");
  Stack_push(stack1, "Third");
  printf("Stack pop: %s\n", Stack_pop(stack1));
  printf("Stack pop: %s\n", Stack_pop(stack1));
  printf("Stack pop: %s\n", Stack_pop(stack1));
  printf("Stack pop: %s\n", Stack_pop(stack1));
  Stack_delete(stack1);
  struct Stack *stack2 = Stack_create(3);
  Stack_push(stack2, "First");
  Stack_push(stack2, "Second");
  Stack_push(stack2, "Third");
  Stack_push(stack2, "Fourth");
  printf("Stack pop: %s\n", Stack_pop(stack2));
  printf("Stack pop: %s\n", Stack_pop(stack2));
  printf("Stack pop: %s\n", Stack_pop(stack2));
  printf("Stack pop: %s\n", Stack_pop(stack2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5,%edi
call   1050 <Stack_create@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1030 <Stack_push@plt>
mov    -0x18(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1030 <Stack_push@plt>
mov    -0x18(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1030 <Stack_push@plt>
mov    -0x18(%rbp),%rdi
call   1060 <Stack_pop@plt>
mov    %rax,%rsi
lea    0xe5c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <Stack_pop@plt>
mov    %rax,%rsi
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <Stack_pop@plt>
mov    %rax,%rsi
lea    0xe2c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <Stack_pop@plt>
mov    %rax,%rsi
lea    0xe14(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <Stack_delete@plt>
mov    $0x3,%edi
call   1050 <Stack_create@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdda(%rip),%rsi
call   1030 <Stack_push@plt>
mov    -0x20(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   1030 <Stack_push@plt>
mov    -0x20(%rbp),%rdi
lea    0xdc7(%rip),%rsi
call   1030 <Stack_push@plt>
mov    -0x20(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   1030 <Stack_push@plt>
mov    -0x20(%rbp),%rdi
call   1060 <Stack_pop@plt>
mov    %rax,%rsi
lea    0xda5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <Stack_pop@plt>
mov    %rax,%rsi
lea    0xd8d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <Stack_pop@plt>
mov    %rax,%rsi
lea    0xd75(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <Stack_pop@plt>
mov    %rax,%rsi
lea    0xd5d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x5,%edi
call   1050 <Stack_create@plt>
mov    %rax,%rbx
lea    0xe93(%rip),%r14
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <Stack_push@plt>
lea    0xe87(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <Stack_push@plt>
lea    0xe7c(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <Stack_push@plt>
mov    %rbx,%rdi
call   1060 <Stack_pop@plt>
lea    0xe68(%rip),%r13
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <Stack_pop@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <Stack_pop@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <Stack_pop@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1070 <Stack_delete@plt>
mov    $0x3,%edi
call   1050 <Stack_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <Stack_push@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <Stack_push@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <Stack_push@plt>
lea    0xdf6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <Stack_push@plt>
mov    %rbx,%rdi
call   1060 <Stack_pop@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <Stack_pop@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <Stack_pop@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <Stack_pop@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.Stack = type { i32 }
@.str = [6 x i8] c"First\00"
@.str.1 = [7 x i8] c"Second\00"
@.str.2 = [6 x i8] c"Third\00"
@.str.3 = [15 x i8] c"Stack pop: %s\0A\00"
@.str.4 = [7 x i8] c"Fourth\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.Stack*
%7 = alloca %struct.Stack*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call %struct.Stack* @Stack_create(i32 5)
store %struct.Stack* %8, %struct.Stack** %6
%9 = load %struct.Stack*, %struct.Stack** %6
%10 = call i32 @Stack_push(%struct.Stack* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = load %struct.Stack*, %struct.Stack** %6
%12 = call i32 @Stack_push(%struct.Stack* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = load %struct.Stack*, %struct.Stack** %6
%14 = call i32 @Stack_push(%struct.Stack* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%15 = load %struct.Stack*, %struct.Stack** %6
%16 = call i8* @Stack_pop(%struct.Stack* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = load %struct.Stack*, %struct.Stack** %6
%19 = call i8* @Stack_pop(%struct.Stack* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %19)
%21 = load %struct.Stack*, %struct.Stack** %6
%22 = call i8* @Stack_pop(%struct.Stack* %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = load %struct.Stack*, %struct.Stack** %6
%25 = call i8* @Stack_pop(%struct.Stack* %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = load %struct.Stack*, %struct.Stack** %6
%28 = call i32 @Stack_delete(%struct.Stack* %27)
%29 = call %struct.Stack* @Stack_create(i32 3)
store %struct.Stack* %29, %struct.Stack** %7
%30 = load %struct.Stack*, %struct.Stack** %7
%31 = call i32 @Stack_push(%struct.Stack* %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%32 = load %struct.Stack*, %struct.Stack** %7
%33 = call i32 @Stack_push(%struct.Stack* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%34 = load %struct.Stack*, %struct.Stack** %7
%35 = call i32 @Stack_push(%struct.Stack* %34, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%36 = load %struct.Stack*, %struct.Stack** %7
%37 = call i32 @Stack_push(%struct.Stack* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%38 = load %struct.Stack*, %struct.Stack** %7
%39 = call i8* @Stack_pop(%struct.Stack* %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %39)
%41 = load %struct.Stack*, %struct.Stack** %7
%42 = call i8* @Stack_pop(%struct.Stack* %41)
%43 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %42)
%44 = load %struct.Stack*, %struct.Stack** %7
%45 = call i8* @Stack_pop(%struct.Stack* %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %45)
%47 = load %struct.Stack*, %struct.Stack** %7
%48 = call i8* @Stack_pop(%struct.Stack* %47)
%49 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %48)
ret i32 0
}

LLVM IR (-O2):
%struct.Stack = type { i32 }
@.str = [6 x i8] c"First\00"
@.str.1 = [7 x i8] c"Second\00"
@.str.2 = [6 x i8] c"Third\00"
@.str.3 = [15 x i8] c"Stack pop: %s\0A\00"
@.str.4 = [7 x i8] c"Fourth\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.Stack* @Stack_create(i32 5)
%4 = tail call i32 @Stack_push(%struct.Stack* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @Stack_push(%struct.Stack* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @Stack_push(%struct.Stack* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i8* @Stack_pop(%struct.Stack* %3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%9 = tail call i8* @Stack_pop(%struct.Stack* %3)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%11 = tail call i8* @Stack_pop(%struct.Stack* %3)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %11)
%13 = tail call i8* @Stack_pop(%struct.Stack* %3)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = tail call i32 @Stack_delete(%struct.Stack* %3)
%16 = tail call %struct.Stack* @Stack_create(i32 3)
%17 = tail call i32 @Stack_push(%struct.Stack* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @Stack_push(%struct.Stack* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @Stack_push(%struct.Stack* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%20 = tail call i32 @Stack_push(%struct.Stack* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%21 = tail call i8* @Stack_pop(%struct.Stack* %16)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = tail call i8* @Stack_pop(%struct.Stack* %16)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = tail call i8* @Stack_pop(%struct.Stack* %16)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = tail call i8* @Stack_pop(%struct.Stack* %16)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %27)
ret i32 0
}