#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;
};
typedef int /*<<< orphan*/ b_new;
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a_new;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, double);
struct stack *stack_create();
int /*<<< orphan*/ stack_pop(struct stack *, ...);
int /*<<< orphan*/ stack_push(struct stack *, ...);
int main(int argc, const char *argv[]) {
  struct stack *s = stack_create();
  int a = 10;
  double b = 18.20;
  stack_push(s, &a, sizeof(a));
  stack_push(s, &b, sizeof(b));
  printf("%d %g\n", a, b);
  int a_new;
  double b_new;
  stack_pop(s, &b_new, sizeof(b_new));
  stack_pop(s, &a_new, sizeof(a_new));
  printf("%d %g\n", a_new, b_new);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <stack_create@plt>
mov    %rax,-0x18(%rbp)
movl   $0xa,-0x1c(%rbp)
movsd  0xe97(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1050 <stack_push@plt>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1050 <stack_push@plt>
mov    -0x1c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1060 <stack_pop@plt>
mov    -0x18(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1060 <stack_pop@plt>
mov    -0x2c(%rbp),%esi
movsd  -0x38(%rbp),%xmm0
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <stack_create@plt>
mov    %rax,%rbx
movl   $0xa,(%rsp)
movabs $0x4032333333333333,%rax
33 32 40
mov    %rax,0x8(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <stack_push@plt>
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <stack_push@plt>
mov    (%rsp),%esi
movsd  0x8(%rsp),%xmm0
lea    0xe63(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    $0x8,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <stack_pop@plt>
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <stack_pop@plt>
mov    0x4(%rsp),%esi
movsd  0x10(%rsp),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stack = type { i32 }
@.str = [7 x i8] c"%d %g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca %struct.stack*
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca double
store i32 %0, i32* %3
store i8** %1, i8*** %4
%10 = call %struct.stack* (...) @stack_create()
store %struct.stack* %10, %struct.stack** %5
store i32 10, i32* %6
store double 1.820000e+01, double* %7
%11 = load %struct.stack*, %struct.stack** %5
%12 = call i32 (%struct.stack*, ...) @stack_push(%struct.stack* %11, i32* %6, i64 4)
%13 = load %struct.stack*, %struct.stack** %5
%14 = call i32 (%struct.stack*, ...) @stack_push(%struct.stack* %13, double* %7, i64 8)
%15 = load i32, i32* %6
%16 = load double, double* %7
%17 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %15, double %16)
%18 = load %struct.stack*, %struct.stack** %5
%19 = call i32 (%struct.stack*, ...) @stack_pop(%struct.stack* %18, double* %9, i64 8)
%20 = load %struct.stack*, %struct.stack** %5
%21 = call i32 (%struct.stack*, ...) @stack_pop(%struct.stack* %20, i32* %8, i64 4)
%22 = load i32, i32* %8
%23 = load double, double* %9
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %22, double %23)
ret i32 0
}

LLVM IR (-O2):
%struct.stack = type { i32 }
@.str = [7 x i8] c"%d %g\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = tail call %struct.stack* (...) @stack_create()
%8 = bitcast i32* %3 to i8*
store i32 10, i32* %3
%9 = bitcast double* %4 to i8*
store double 1.820000e+01, double* %4
%10 = call i32 (%struct.stack*, ...) @stack_push(%struct.stack* %7, i32* %3, i64 4)
%11 = call i32 (%struct.stack*, ...) @stack_push(%struct.stack* %7, double* %4, i64 8)
%12 = load i32, i32* %3
%13 = load double, double* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %12, double %13)
%15 = bitcast i32* %5 to i8*
%16 = bitcast double* %6 to i8*
%17 = call i32 (%struct.stack*, ...) @stack_pop(%struct.stack* %7, double* %6, i64 8)
%18 = call i32 (%struct.stack*, ...) @stack_pop(%struct.stack* %7, i32* %5, i64 4)
%19 = load i32, i32* %5
%20 = load double, double* %6
%21 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %19, double %20)
ret i32 0
}