#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 */
typedef unsigned int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void __sanitizer_cov_trace_pc_guard_init(uint32_t *start, uint32_t *stop) {
  static bool inited = false;
  if (inited == true) {
    return;
  }
  inited = true;
  uint32_t n = 1U;
  for (uint32_t *x = start; x < stop; x++, n++) {
    if (n >= (1024U * 1024U)) {
      fprintf(stderr, "This process has too many PC guards\n");
      exit(1);
    }
    *x = n;
  }
}


x86 assembly (clang, -O0):
<__sanitizer_cov_trace_pc_guard_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,0x2efd(%rip)
jne    1142 <__sanitizer_cov_trace_pc_guard_init+0x22>
jmp    11b8 <__sanitizer_cov_trace_pc_guard_init+0x98>
movl   $0x1,0x2ee8(%rip)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11b8 <__sanitizer_cov_trace_pc_guard_init+0x98>
cmpl   $0x100000,-0x14(%rbp)
jb     1195 <__sanitizer_cov_trace_pc_guard_init+0x75>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <__sanitizer_cov_trace_pc_guard_init+0x3b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sanitizer_cov_trace_pc_guard_init>:
push   %rax
cmpb   $0x0,0x2f0c(%rip)
jne    118d <__sanitizer_cov_trace_pc_guard_init+0x6d>
movb   $0x1,0x2f03(%rip)
cmp    %rsi,%rdi
jae    118d <__sanitizer_cov_trace_pc_guard_init+0x6d>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
lea    0x1(%rax),%rdx
mov    %edx,(%rdi,%rax,4)
lea    (%rdi,%rax,4),%rcx
add    $0x4,%rcx
cmp    %rsi,%rcx
jae    118d <__sanitizer_cov_trace_pc_guard_init+0x6d>
add    $0x1,%rdx
mov    %edx,(%rcx)
add    $0x4,%rcx
cmp    %rsi,%rcx
jae    118d <__sanitizer_cov_trace_pc_guard_init+0x6d>
add    $0x1,%rdx
mov    %edx,(%rcx)
add    $0x4,%rcx
cmp    %rsi,%rcx
jae    118d <__sanitizer_cov_trace_pc_guard_init+0x6d>
add    $0x1,%rdx
cmp    $0x100000,%edx
je     118f <__sanitizer_cov_trace_pc_guard_init+0x6f>
mov    %edx,(%rcx)
add    $0x4,%rax
add    $0x4,%rcx
cmp    %rsi,%rcx
jb     1140 <__sanitizer_cov_trace_pc_guard_init+0x20>
pop    %rax
ret
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@__sanitizer_cov_trace_pc_guard_init.inited = internal global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"This process has too many PC guards\0A\00"
define void @__sanitizer_cov_trace_pc_guard_init(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = load i32, i32* @__sanitizer_cov_trace_pc_guard_init.inited
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %2
br label %31
10: ; preds = %2
store i32 1, i32* @__sanitizer_cov_trace_pc_guard_init.inited
store i32 1, i32* %5
%11 = load i32*, i32** %3
store i32* %11, i32** %6
br label %12
12: ; preds = %26, %10
%13 = load i32*, i32** %6
%14 = load i32*, i32** %4
%15 = icmp ult i32* %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i32, i32* %5
%18 = icmp uge i32 %17, 1048576
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %16
%24 = load i32, i32* %5
%25 = load i32*, i32** %6
store i32 %24, i32* %25
br label %26
26: ; preds = %23
%27 = load i32*, i32** %6
%28 = getelementptr inbounds i32, i32* %27, i32 1
store i32* %28, i32** %6
%29 = load i32, i32* %5
%30 = add i32 %29, 1
store i32 %30, i32* %5
br label %12
31: ; preds = %9, %12
ret void
}

LLVM IR (-O2):
@__sanitizer_cov_trace_pc_guard_init.inited = internal unnamed_addr global i1 false
@stderr = global i32 0
@.str = [37 x i8] c"This process has too many PC guards\0A\00"
define void @__sanitizer_cov_trace_pc_guard_init(i32* writeonly %0, i32* readnone %1) {
%3 = load i1, i1* @__sanitizer_cov_trace_pc_guard_init.inited
br i1 %3, label %30, label %4
4: ; preds = %2
store i1 true, i1* @__sanitizer_cov_trace_pc_guard_init.inited
%5 = icmp ult i32* %0, %1
br i1 %5, label %6, label %30
6: ; preds = %4, %26
%7 = phi i32* [ %27, %26 ], [ %0, %4 ]
%8 = phi i32 [ %28, %26 ], [ 1, %4 ]
store i32 %8, i32* %7
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = add nuw nsw i32 %8, 1
%11 = icmp ult i32* %9, %1
br i1 %11, label %16, label %30
12: ; preds = %24
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %6
store i32 %10, i32* %9
%17 = getelementptr inbounds i32, i32* %7, i64 2
%18 = add nuw nsw i32 %8, 2
%19 = icmp ult i32* %17, %1
br i1 %19, label %20, label %30
20: ; preds = %16
store i32 %18, i32* %17
%21 = getelementptr inbounds i32, i32* %7, i64 3
%22 = add nuw nsw i32 %8, 3
%23 = icmp ult i32* %21, %1
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = icmp eq i32 %22, 1048576
br i1 %25, label %12, label %26
26: ; preds = %24
store i32 %22, i32* %21
%27 = getelementptr inbounds i32, i32* %7, i64 4
%28 = add nuw nsw i32 %8, 4
%29 = icmp ult i32* %27, %1
br i1 %29, label %6, label %30
30: ; preds = %6, %16, %20, %26, %4, %2
ret void
}