#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 */
int *malloc(int);
int /*<<< orphan*/ save_page(char *, void *);
int main(int argc, char **argv) {
  volatile int cafe1 = 0xCAFE1111;
  (void)cafe1;
  volatile int cafe2 = 0xCAFE2222;
  (void)cafe2;
  volatile int cafe3[2] = {0xCAFE3333, 0xCAFE4444};
  (void)cafe3;
  volatile int *beef1 = malloc(sizeof(int));
  (void)beef1;
  volatile int *beef2 = malloc(sizeof(int));
  (void)beef2;
  volatile int *beef3 = malloc(2 * sizeof(int));
  (void)beef3;
  *beef1 = 0xBEEF1111;
  *beef2 = 0xBEEF2222;
  beef3[0] = 0xBEEF3333;
  beef3[1] = 0xBEEF4444;
  save_page("beef.page", (void *)beef1);
  save_page("cafe.page", (void *)&cafe1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xcafe1111,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movl   $0xcafe2222,-0x18(%rbp)
mov    -0x18(%rbp),%eax
lea    -0x20(%rbp),%rax
mov    0xeab(%rip),%rcx
mov    %rcx,(%rax)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movl   $0xbeef1111,(%rax)
mov    -0x30(%rbp),%rax
movl   $0xbeef2222,(%rax)
mov    -0x38(%rbp),%rax
movl   $0xbeef3333,(%rax)
mov    -0x38(%rbp),%rax
movl   $0xbeef4444,0x4(%rax)
mov    -0x28(%rbp),%rsi
lea    0xe52(%rip),%rdi
call   1040 <save_page@plt>
lea    -0x14(%rbp),%rsi
lea    0xe4c(%rip),%rdi
call   1040 <save_page@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0xcafe1111,0x8(%rsp)
ca
mov    0x8(%rsp),%eax
movl   $0xcafe2222,0xc(%rsp)
ca
mov    0xc(%rsp),%eax
mov    0xeba(%rip),%rax
mov    %rax,0x10(%rsp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1030 <malloc@plt>
movl   $0xbeef1111,(%rbx)
movl   $0xbeef2222,(%r14)
movl   $0xbeef3333,(%rax)
movl   $0xbeef4444,0x4(%rax)
lea    0xe78(%rip),%rdi
mov    %rbx,%rsi
call   1040 <save_page@plt>
lea    0xe73(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <save_page@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.cafe3 = [2 x i32] [i32 -889310413, i32 -889306044]
@.str = [10 x i8] c"beef.page\00"
@.str.1 = [10 x i8] c"cafe.page\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [2 x i32]
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store volatile i32 -889319151, i32* %6
%12 = load volatile i32, i32* %6
store volatile i32 -889314782, i32* %7
%13 = load volatile i32, i32* %7
%14 = bitcast [2 x i32]* %8 to i8*
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%16 = call i32* @malloc(i32 4)
store i32* %16, i32** %9
%17 = load i32*, i32** %9
%18 = call i32* @malloc(i32 4)
store i32* %18, i32** %10
%19 = load i32*, i32** %10
%20 = call i32* @malloc(i32 8)
store i32* %20, i32** %11
%21 = load i32*, i32** %11
%22 = load i32*, i32** %9
store volatile i32 -1091628783, i32* %22
%23 = load i32*, i32** %10
store volatile i32 -1091624414, i32* %23
%24 = load i32*, i32** %11
%25 = getelementptr inbounds i32, i32* %24, i64 0
store volatile i32 -1091620045, i32* %25
%26 = load i32*, i32** %11
%27 = getelementptr inbounds i32, i32* %26, i64 1
store volatile i32 -1091615676, i32* %27
%28 = load i32*, i32** %9
%29 = bitcast i32* %28 to i8*
%30 = call i32 @save_page(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %29)
%31 = bitcast i32* %6 to i8*
%32 = call i32 @save_page(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %31)
ret i32 0
}

LLVM IR (-O2):
@__const.main.cafe3 = [2 x i32] [i32 -889310413, i32 -889306044]
@.str = [10 x i8] c"beef.page\00"
@.str.1 = [10 x i8] c"cafe.page\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = bitcast i32* %3 to i8*
store volatile i32 -889319151, i32* %3
%7 = load volatile i32, i32* %3
%8 = bitcast i32* %4 to i8*
store volatile i32 -889314782, i32* %4
%9 = load volatile i32, i32* %4
%10 = bitcast i64* %5 to i8*
%11 = load volatile i64, i64* bitcast ([2 x i32]* @__const.main.cafe3 to i64*)
store volatile i64 %11, i64* %5
%12 = tail call i32* @malloc(i32 4)
%13 = tail call i32* @malloc(i32 4)
%14 = tail call i32* @malloc(i32 8)
store volatile i32 -1091628783, i32* %12
store volatile i32 -1091624414, i32* %13
store volatile i32 -1091620045, i32* %14
%15 = getelementptr inbounds i32, i32* %14, i64 1
store volatile i32 -1091615676, i32* %15
%16 = bitcast i32* %12 to i8*
%17 = tail call i32 @save_page(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i32 @save_page(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret i32 0
}