#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 MAP_ANON;
int MAP_FIXED;
int MAP_NORESERVE;
int MAP_PRIVATE;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
void *mmap(void *, unsigned long, int, int, int /*<<< orphan*/,
           int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void __asan_init_v3() {
  static int inited = 0;
  if (inited)
    return;
  inited = 1;
  unsigned long start = 0x20000000;
  unsigned long size = 0x20000000;
  void *res = mmap((void *)start, size, PROT_READ | PROT_WRITE,
                   MAP_PRIVATE | MAP_ANON | MAP_FIXED | MAP_NORESERVE, 0, 0);
  if (res == (void *)start) {
    fprintf(stderr, "Fake AddressSanitizer run-time initialized ok at %p\n",
            res);
  } else {
    fprintf(stderr, "Fake AddressSanitizer run-time failed to initialize.\n"
                    "You have been warned. Aborting.");
    abort();
  }
}


x86 assembly (clang, -O0):
<__asan_init_v3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpl   $0x0,0x2efd(%rip)
je     114a <__asan_init_v3+0x1a>
jmp    1200 <__asan_init_v3+0xd0>
movl   $0x1,0x2ee8(%rip)
movq   $0x20000000,-0x8(%rbp)
20
movq   $0x20000000,-0x10(%rbp)
20
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    0x2e4c(%rip),%rax
or     (%rax),%edx
mov    0x2e33(%rip),%rax
mov    (%rax),%ecx
mov    0x2e32(%rip),%rax
or     (%rax),%ecx
mov    0x2e19(%rip),%rax
or     (%rax),%ecx
mov    0x2e40(%rip),%rax
or     (%rax),%ecx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1040 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
cmp    %rcx,%rax
jne    11e2 <__asan_init_v3+0xb2>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe2a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1200 <__asan_init_v3+0xd0>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__asan_init_v3>:
push   %rax
cmpb   $0x0,0x2f04(%rip)
je     113c <__asan_init_v3+0xc>
pop    %rax
ret
mov    0x2eb5(%rip),%rax
mov    0x2e7e(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e63(%rip),%rax
mov    0x2e64(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2e49(%rip),%rax
or     (%rax),%ecx
movb   $0x1,0x2ecc(%rip)
mov    0x2e69(%rip),%rax
or     (%rax),%ecx
mov    $0x20000000,%edi
mov    $0x20000000,%esi
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    0x2e3b(%rip),%rcx
mov    (%rcx),%edi
cmp    $0x20000000,%rax
jne    11b3 <__asan_init_v3+0x83>
lea    0xe5a(%rip),%rsi
mov    $0x20000000,%edx
xor    %eax,%eax
pop    %rcx
jmp    1050 <fprintf@plt>
lea    0xe7b(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__asan_init_v3.inited = internal global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANON = global i32 0
@MAP_FIXED = global i32 0
@MAP_NORESERVE = global i32 0
@stderr = global i32 0
@.str = [53 x i8] c"Fake AddressSanitizer run-time initialized ok at %p\0A\00"
@.str.1 = [85 x i8] c"Fake AddressSanitizer run-time failed to initialize.\0AYou have been warned. Aborting.\00"
define void @__asan_init_v3() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i8*
%4 = load i32, i32* @__asan_init_v3.inited
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
br label %34
7: ; preds = %0
store i32 1, i32* @__asan_init_v3.inited
store i64 536870912, i64* %1
store i64 536870912, i64* %2
%8 = load i64, i64* %1
%9 = inttoptr i64 %8 to i8*
%10 = load i64, i64* %2
%11 = load i32, i32* @PROT_READ
%12 = load i32, i32* @PROT_WRITE
%13 = or i32 %11, %12
%14 = load i32, i32* @MAP_PRIVATE
%15 = load i32, i32* @MAP_ANON
%16 = or i32 %14, %15
%17 = load i32, i32* @MAP_FIXED
%18 = or i32 %16, %17
%19 = load i32, i32* @MAP_NORESERVE
%20 = or i32 %18, %19
%21 = call i8* @mmap(i8* %9, i64 %10, i32 %13, i32 %20, i32 0, i32 0)
store i8* %21, i8** %3
%22 = load i8*, i8** %3
%23 = load i64, i64* %1
%24 = inttoptr i64 %23 to i8*
%25 = icmp eq i8* %22, %24
br i1 %25, label %26, label %30
26: ; preds = %7
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %3
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %28)
br label %34
30: ; preds = %7
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 (...) @abort()
unreachable
34: ; preds = %6, %26
ret void
}

LLVM IR (-O2):
@__asan_init_v3.inited = internal unnamed_addr global i1 false
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANON = global i32 0
@MAP_FIXED = global i32 0
@MAP_NORESERVE = global i32 0
@stderr = global i32 0
@.str = [53 x i8] c"Fake AddressSanitizer run-time initialized ok at %p\0A\00"
@.str.1 = [85 x i8] c"Fake AddressSanitizer run-time failed to initialize.\0AYou have been warned. Aborting.\00"
define void @__asan_init_v3() {
%1 = load i1, i1* @__asan_init_v3.inited
br i1 %1, label %21, label %2
2: ; preds = %0
store i1 true, i1* @__asan_init_v3.inited
%3 = load i32, i32* @PROT_READ
%4 = load i32, i32* @PROT_WRITE
%5 = or i32 %4, %3
%6 = load i32, i32* @MAP_PRIVATE
%7 = load i32, i32* @MAP_ANON
%8 = or i32 %7, %6
%9 = load i32, i32* @MAP_FIXED
%10 = or i32 %8, %9
%11 = load i32, i32* @MAP_NORESERVE
%12 = or i32 %10, %11
%13 = tail call i8* @mmap(i8* inttoptr (i64 536870912 to i8*), i64 536870912, i32 %5, i32 %12, i32 0, i32 0)
%14 = icmp eq i8* %13, inttoptr (i64 536870912 to i8*)
%15 = load i32, i32* @stderr
br i1 %14, label %16, label %18
16: ; preds = %2
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* inttoptr (i64 536870912 to i8*))
br label %21
18: ; preds = %2
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 (...) @abort()
unreachable
21: ; preds = %0, %16
ret void
}