; LLVM IR from AngoraFuzzer/Angora :: llvm_mode/dfsan_rt/sanitizer_common (sanitizer_procmaps_common)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.__sanitizer::MemoryMappingLayout" = type { %"struct.__sanitizer::ProcSelfMapsBuff", ptr }
%"struct.__sanitizer::ProcSelfMapsBuff" = type { ptr, i64, i64 }

@.str = external hidden unnamed_addr constant [118 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer19MemoryMappingLayoutC2Eb(ptr noundef nonnull align 8 dereferenceable(32) %0, i1 noundef zeroext %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %9 = zext i1 %1 to i8
  store i8 %9, ptr %4, align 1, !tbaa !9
  %10 = load ptr, ptr %3, align 8
  %11 = getelementptr inbounds %"class.__sanitizer::MemoryMappingLayout", ptr %10, i32 0, i32 0
  %12 = getelementptr inbounds %"class.__sanitizer::MemoryMappingLayout", ptr %10, i32 0, i32 0
  call void @_ZN11__sanitizer12ReadProcMapsEPNS_16ProcSelfMapsBuffE(ptr noundef %12)
  %13 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %14 = trunc i8 %13 to i1
  br i1 %14, label %15, label %40

15:                                               ; preds = %2
  %16 = getelementptr inbounds %"class.__sanitizer::MemoryMappingLayout", ptr %10, i32 0, i32 0
  %17 = getelementptr inbounds %"struct.__sanitizer::ProcSelfMapsBuff", ptr %16, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !13
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %20, label %39

20:                                               ; preds = %15
  call void @_ZN11__sanitizer19MemoryMappingLayout13LoadFromCacheEv(ptr noundef nonnull align 8 dereferenceable(32) %10)
  br label %21

21:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %22 = getelementptr inbounds %"class.__sanitizer::MemoryMappingLayout", ptr %10, i32 0, i32 0
  %23 = getelementptr inbounds %"struct.__sanitizer::ProcSelfMapsBuff", ptr %22, i32 0, i32 2
  %24 = load i64, ptr %23, align 8, !tbaa !17
  store i64 %24, ptr %5, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !18
  %25 = load i64, ptr %5, align 8, !tbaa !18
  %26 = load i64, ptr %6, align 8, !tbaa !18
  %27 = icmp ugt i64 %25, %26
  %28 = xor i1 %27, true
  %29 = xor i1 %28, true
  %30 = xor i1 %29, true
  %31 = zext i1 %30 to i64
  %32 = call i64 @llvm.expect.i64(i64 %31, i64 0)
  %33 = icmp ne i64 %32, 0
  br i1 %33, label %34, label %37

34:                                               ; preds = %21
  %35 = load i64, ptr %5, align 8, !tbaa !18
  %36 = load i64, ptr %6, align 8, !tbaa !18
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str, i32 noundef 72, ptr noundef @.str.1, i64 noundef %35, i64 noundef %36) #7
  unreachable

37:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38, %15
  br label %59

40:                                               ; preds = %2
  br label %41

41:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %42 = getelementptr inbounds %"class.__sanitizer::MemoryMappingLayout", ptr %10, i32 0, i32 0
  %43 = getelementptr inbounds %"struct.__sanitizer::ProcSelfMapsBuff", ptr %42, i32 0, i32 1
  %44 = load i64, ptr %43, align 8, !tbaa !13
  store i64 %44, ptr %7, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !18
  %45 = load i64, ptr %7, align 8, !tbaa !18
  %46 = load i64, ptr %8, align 8, !tbaa !18
  %47 = icmp ugt i64 %45, %46
  %48 = xor i1 %47, true
  %49 = xor i1 %48, true
  %50 = xor i1 %49, true
  %51 = zext i1 %50 to i64
  %52 = call i64 @llvm.expect.i64(i64 %51, i64 0)
  %53 = icmp ne i64 %52, 0
  br i1 %53, label %54, label %57

54:                                               ; preds = %41
  %55 = load i64, ptr %7, align 8, !tbaa !18
  %56 = load i64, ptr %8, align 8, !tbaa !18
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str, i32 noundef 75, ptr noundef @.str.2, i64 noundef %55, i64 noundef %56) #7
  unreachable

57:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58, %39
  call void @_ZN11__sanitizer19MemoryMappingLayout5ResetEv(ptr noundef nonnull align 8 dereferenceable(32) %10)
  %60 = load i8, ptr %4, align 1, !tbaa !9, !range !11, !noundef !12
  %61 = trunc i8 %60 to i1
  br i1 %61, label %62, label %63

62:                                               ; preds = %59
  call void @_ZN11__sanitizer19MemoryMappingLayout19CacheMemoryMappingsEv()
  br label %63

63:                                               ; preds = %62, %59
  ret void
}

declare void @_ZN11__sanitizer12ReadProcMapsEPNS_16ProcSelfMapsBuffE(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer19MemoryMappingLayout13LoadFromCacheEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

; Function Attrs: noreturn
declare void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef, i32 noundef, ptr noundef, i64 noundef, i64 noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11__sanitizer19MemoryMappingLayout5ResetEv(ptr noundef nonnull align 8 dereferenceable(32)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer19MemoryMappingLayout19CacheMemoryMappingsEv() #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #4 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { noreturn }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !16, i64 8}
!14 = !{!"_ZTSN11__sanitizer19MemoryMappingLayoutE", !15, i64 0, !6, i64 24}
!15 = !{!"_ZTSN11__sanitizer16ProcSelfMapsBuffE", !6, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!14, !16, i64 16}
!18 = !{!19, !19, i64 0}
!19 = !{!"long long", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [118 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer19MemoryMappingLayoutC2Eb(ptr noundef nonnull align 8 dereferenceable(32) %0, i1 noundef zeroext %1) unnamed_addr #0 align 2 {
  tail call void @_ZN11__sanitizer12ReadProcMapsEPNS_16ProcSelfMapsBuffE(ptr noundef nonnull %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i64 %4, 0
  br i1 %1, label %6, label %11

6:                                                ; preds = %2
  br i1 %5, label %7, label %14

7:                                                ; preds = %6
  tail call void @_ZN11__sanitizer19MemoryMappingLayout13LoadFromCacheEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load i64, ptr %8, align 8, !tbaa !12
  %.not10 = icmp eq i64 %9, 0
  br i1 %.not10, label %10, label %14, !prof !13

10:                                               ; preds = %7
  tail call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef nonnull @.str, i32 noundef 72, ptr noundef nonnull @.str.1, i64 noundef 0, i64 noundef 0) #4
  unreachable

11:                                               ; preds = %2
  br i1 %5, label %12, label %13, !prof !13

12:                                               ; preds = %11
  tail call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef nonnull @.str, i32 noundef 75, ptr noundef nonnull @.str.2, i64 noundef 0, i64 noundef 0) #4
  unreachable

13:                                               ; preds = %11
  tail call void @_ZN11__sanitizer19MemoryMappingLayout5ResetEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  br label %15

14:                                               ; preds = %7, %6
  tail call void @_ZN11__sanitizer19MemoryMappingLayout5ResetEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  tail call void @_ZN11__sanitizer19MemoryMappingLayout19CacheMemoryMappingsEv()
  br label %15

15:                                               ; preds = %13, %14
  ret void
}

declare void @_ZN11__sanitizer12ReadProcMapsEPNS_16ProcSelfMapsBuffE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer19MemoryMappingLayout13LoadFromCacheEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

; Function Attrs: noreturn
declare void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef, i32 noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11__sanitizer19MemoryMappingLayout5ResetEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer19MemoryMappingLayout19CacheMemoryMappingsEv() local_unnamed_addr #0 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { noreturn }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 8}
!6 = !{!"_ZTSN11__sanitizer19MemoryMappingLayoutE", !7, i64 0, !8, i64 24}
!7 = !{!"_ZTSN11__sanitizer16ProcSelfMapsBuffE", !8, i64 0, !11, i64 8, !11, i64 16}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!6, !11, i64 16}
!13 = !{!"branch_weights", !"expected", i32 1, i32 2000}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass