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

/* Variables and functions */
struct integer_stack_head *init_integer_stack(int);
int pop(struct integer_stack_head *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ push(struct integer_stack_head *, int);
void TEST_should_push_and_pop_three_integers_to_integer_stack() {
  struct integer_stack_head *integer_stack = init_integer_stack(3);
  printf(
      "\nRunning: TEST_should_push_and_pop_three_integers_to_integer_stack.");
  push(integer_stack, 1);
  push(integer_stack, 2);
  push(integer_stack, 3);
  printf("\nStack pop: %d,", pop(integer_stack));
  printf("\nStack pop: %d,", pop(integer_stack));
  printf("\nStack pop: %d,", pop(integer_stack));
}


x86 assembly (clang, -O0):
<TEST_should_push_and_pop_three_integers_to_integer_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
call   1030 <init_integer_stack@plt>
mov    %rax,-0x8(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1060 <push@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1060 <push@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1060 <push@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pop@plt>
mov    %eax,%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_should_push_and_pop_three_integers_to_integer_stack>:
push   %r14
push   %rbx
push   %rax
mov    $0x3,%edi
call   1030 <init_integer_stack@plt>
mov    %rax,%rbx
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <push@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <push@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1060 <push@plt>
mov    %rbx,%rdi
call   1050 <pop@plt>
lea    0xeaf(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <pop@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <pop@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.integer_stack_head = type { i32 }
@.str = [68 x i8] c"\0ARunning: TEST_should_push_and_pop_three_integers_to_integer_stack.\00"
@.str.1 = [16 x i8] c"\0AStack pop: %d,\00"
define void @TEST_should_push_and_pop_three_integers_to_integer_stack() {
%1 = alloca %struct.integer_stack_head*
%2 = call %struct.integer_stack_head* @init_integer_stack(i32 3)
store %struct.integer_stack_head* %2, %struct.integer_stack_head** %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.integer_stack_head*, %struct.integer_stack_head** %1
%5 = call i32 @push(%struct.integer_stack_head* %4, i32 1)
%6 = load %struct.integer_stack_head*, %struct.integer_stack_head** %1
%7 = call i32 @push(%struct.integer_stack_head* %6, i32 2)
%8 = load %struct.integer_stack_head*, %struct.integer_stack_head** %1
%9 = call i32 @push(%struct.integer_stack_head* %8, i32 3)
%10 = load %struct.integer_stack_head*, %struct.integer_stack_head** %1
%11 = call i32 @pop(%struct.integer_stack_head* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load %struct.integer_stack_head*, %struct.integer_stack_head** %1
%14 = call i32 @pop(%struct.integer_stack_head* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load %struct.integer_stack_head*, %struct.integer_stack_head** %1
%17 = call i32 @pop(%struct.integer_stack_head* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret void
}

LLVM IR (-O2):
%struct.integer_stack_head = type { i32 }
@.str = [68 x i8] c"\0ARunning: TEST_should_push_and_pop_three_integers_to_integer_stack.\00"
@.str.1 = [16 x i8] c"\0AStack pop: %d,\00"
define void @TEST_should_push_and_pop_three_integers_to_integer_stack() {
%1 = tail call %struct.integer_stack_head* @init_integer_stack(i32 3)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @push(%struct.integer_stack_head* %1, i32 1)
%4 = tail call i32 @push(%struct.integer_stack_head* %1, i32 2)
%5 = tail call i32 @push(%struct.integer_stack_head* %1, i32 3)
%6 = tail call i32 @pop(%struct.integer_stack_head* %1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @pop(%struct.integer_stack_head* %1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = tail call i32 @pop(%struct.integer_stack_head* %1)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret void
}