#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 /*<<< orphan*/ mmapAlloc();
int /*<<< orphan*/ mmapAnonPrivate();
int /*<<< orphan*/ mmapAnonShared();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ readExample();
int /*<<< orphan*/ readExampleChange();
int /*<<< orphan*/ writeExample();
int main(void) {
  printf("================= SUMMARY OF MMAP() OPTIONS ===================\n");
  printf("        | File-backed (default)      | Anonymous               \n");
  printf("--------+----------------------------+-------------------------\n");
  printf("Private:| Init memory based on file. | Like malloc(), init to 0\n");
  printf("--------+----------------------------+-------------------------\n");
  printf("Shared: | Init memory based on file. | Share memory between    \n");
  printf("        | Write to file when done.   | processes. Init to 0.   \n");
  printf("        | Shared between processes.  |                         \n");
  printf("\n\n--- readExample() ---\n");
  readExample();
  printf("\n\n--- readExampleChange() ---\n");
  readExampleChange();
  printf("\n\n--- writeExample() ---\n");
  writeExample();
  printf("\n\n--- mmapAlloc() ---\n");
  mmapAlloc();
  printf("\n\n--- mmapAnonPrivate() ---\n");
  mmapAnonPrivate();
  printf("\n\n--- mmapAnonShared() ---\n");
  mmapAnonShared();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xe85(%rip),%rdi
call   1050 <printf@plt>
lea    0xeba(%rip),%rdi
call   1050 <printf@plt>
lea    0xeef(%rip),%rdi
call   1050 <printf@plt>
lea    0xf24(%rip),%rdi
call   1050 <printf@plt>
lea    0xed7(%rip),%rdi
call   1050 <printf@plt>
lea    0xf4d(%rip),%rdi
call   1050 <printf@plt>
lea    0xf82(%rip),%rdi
call   1050 <printf@plt>
lea    0xfb7(%rip),%rdi
call   1050 <printf@plt>
lea    0xfec(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <readExample@plt>
lea    0xff2(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <readExampleChange@plt>
lea    0xffe(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <writeExample@plt>
lea    0x1005(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <mmapAlloc@plt>
lea    0x1009(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1090 <mmapAnonPrivate@plt>
lea    0x1013(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <mmapAnonShared@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
lea    0xf30(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xee1(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xf4d(%rip),%rdi
call   1040 <puts@plt>
lea    0xf81(%rip),%rdi
call   1040 <puts@plt>
lea    0xfb5(%rip),%rdi
call   1040 <puts@plt>
lea    0xfe9(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <readExample@plt>
lea    0xfee(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <readExampleChange@plt>
lea    0xff9(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <writeExample@plt>
lea    0xfff(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <mmapAlloc@plt>
lea    0x1002(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1090 <mmapAnonPrivate@plt>
lea    0x100b(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <mmapAnonShared@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [65 x i8] c"================= SUMMARY OF MMAP() OPTIONS ===================\0A\00"
@.str.1 = [65 x i8] c" | File-backed (default) | Anonymous \0A\00"
@.str.2 = [65 x i8] c"--------+----------------------------+-------------------------\0A\00"
@.str.3 = [65 x i8] c"Private:| Init memory based on file. | Like malloc(), init to 0\0A\00"
@.str.4 = [65 x i8] c"Shared: | Init memory based on file. | Share memory between \0A\00"
@.str.5 = [65 x i8] c" | Write to file when done. | processes. Init to 0. \0A\00"
@.str.6 = [65 x i8] c" | Shared between processes. | \0A\00"
@.str.7 = [25 x i8] c"\0A\0A--- readExample() ---\0A\00"
@.str.8 = [31 x i8] c"\0A\0A--- readExampleChange() ---\0A\00"
@.str.9 = [26 x i8] c"\0A\0A--- writeExample() ---\0A\00"
@.str.10 = [23 x i8] c"\0A\0A--- mmapAlloc() ---\0A\00"
@.str.11 = [29 x i8] c"\0A\0A--- mmapAnonPrivate() ---\0A\00"
@.str.12 = [28 x i8] c"\0A\0A--- mmapAnonShared() ---\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
%10 = call i32 (...) @readExample()
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 (...) @readExampleChange()
%13 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 (...) @writeExample()
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
%16 = call i32 (...) @mmapAlloc()
%17 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0))
%18 = call i32 (...) @mmapAnonPrivate()
%19 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0))
%20 = call i32 (...) @mmapAnonShared()
ret i32 0
}

LLVM IR (-O2):
@str = [64 x i8] c"================= SUMMARY OF MMAP() OPTIONS ===================\00"
@str.13 = [64 x i8] c" | File-backed (default) | Anonymous \00"
@str.15 = [64 x i8] c"Private:| Init memory based on file. | Like malloc(), init to 0\00"
@str.16 = [64 x i8] c"--------+----------------------------+-------------------------\00"
@str.17 = [64 x i8] c"Shared: | Init memory based on file. | Share memory between \00"
@str.18 = [64 x i8] c" | Write to file when done. | processes. Init to 0. \00"
@str.19 = [64 x i8] c" | Shared between processes. | \00"
@str.20 = [24 x i8] c"\0A\0A--- readExample() ---\00"
@str.21 = [30 x i8] c"\0A\0A--- readExampleChange() ---\00"
@str.22 = [25 x i8] c"\0A\0A--- writeExample() ---\00"
@str.23 = [22 x i8] c"\0A\0A--- mmapAlloc() ---\00"
@str.24 = [28 x i8] c"\0A\0A--- mmapAnonPrivate() ---\00"
@str.25 = [27 x i8] c"\0A\0A--- mmapAnonShared() ---\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.13, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.16, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.15, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.17, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.18, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.19, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.20, i64 0, i64 0))
%10 = tail call i32 (...) @readExample()
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.21, i64 0, i64 0))
%12 = tail call i32 (...) @readExampleChange()
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.22, i64 0, i64 0))
%14 = tail call i32 (...) @writeExample()
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.23, i64 0, i64 0))
%16 = tail call i32 (...) @mmapAlloc()
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.24, i64 0, i64 0))
%18 = tail call i32 (...) @mmapAnonPrivate()
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.25, i64 0, i64 0))
%20 = tail call i32 (...) @mmapAnonShared()
ret i32 0
}