#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 */

/* Variables and functions */
void *double_stack_new();
double double_stack_pop(void *);
int /*<<< orphan*/ double_stack_push(void *, double);
int /*<<< orphan*/ printf(char *, double, double, double);
int main(void) {
  void *stack = double_stack_new();
  double_stack_push(stack, 5.0);
  double_stack_push(stack, 6.0);
  double_stack_push(stack, 7.0);
  printf("Should be 7, 6, 5: %g, %g, %g.\n", double_stack_pop(stack),
         double_stack_pop(stack), double_stack_pop(stack));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1060 <double_stack_new@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
movsd  0xeb1(%rip),%xmm0
call   1030 <double_stack_push@plt>
mov    -0x8(%rbp),%rdi
movsd  0xe98(%rip),%xmm0
call   1030 <double_stack_push@plt>
mov    -0x8(%rbp),%rdi
movsd  0xe7f(%rip),%xmm0
call   1030 <double_stack_push@plt>
mov    -0x8(%rbp),%rdi
call   1050 <double_stack_pop@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <double_stack_pop@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <double_stack_pop@plt>
movsd  -0x18(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x10(%rbp),%xmm0
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1060 <double_stack_new@plt>
mov    %rax,%rbx
movsd  0xea9(%rip),%xmm0
mov    %rax,%rdi
call   1030 <double_stack_push@plt>
movsd  0xea1(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <double_stack_push@plt>
movsd  0xe99(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <double_stack_push@plt>
mov    %rbx,%rdi
call   1050 <double_stack_pop@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1050 <double_stack_pop@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1050 <double_stack_pop@plt>
movaps %xmm0,%xmm2
lea    0xe6c(%rip),%rdi
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Should be 7, 6, 5: %g, %g, %g.\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = call i8* (...) @double_stack_new()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @double_stack_push(i8* %3, double 5.000000e+00)
%5 = load i8*, i8** %1
%6 = call i32 @double_stack_push(i8* %5, double 6.000000e+00)
%7 = load i8*, i8** %1
%8 = call i32 @double_stack_push(i8* %7, double 7.000000e+00)
%9 = load i8*, i8** %1
%10 = call double @double_stack_pop(i8* %9)
%11 = load i8*, i8** %1
%12 = call double @double_stack_pop(i8* %11)
%13 = load i8*, i8** %1
%14 = call double @double_stack_pop(i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %10, double %12, double %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Should be 7, 6, 5: %g, %g, %g.\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @double_stack_new()
%2 = tail call i32 @double_stack_push(i8* %1, double 5.000000e+00)
%3 = tail call i32 @double_stack_push(i8* %1, double 6.000000e+00)
%4 = tail call i32 @double_stack_push(i8* %1, double 7.000000e+00)
%5 = tail call double @double_stack_pop(i8* %1)
%6 = tail call double @double_stack_pop(i8* %1)
%7 = tail call double @double_stack_pop(i8* %1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %5, double %6, double %7)
ret i32 0
}