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

; 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"

@.str.2 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN11__sanitizer9RoundUpToEmm(i64 noundef, i64 noundef) #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN11__sanitizer17GetPageSizeCachedEv() #0

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

declare noundef i64 @_ZN11__sanitizer13internal_mmapEPvmiiiy(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) #2

declare noundef zeroext i1 @_ZN11__sanitizer16internal_iserrorEmPi(i64 noundef, ptr noundef) #2

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

; 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 uwtable
declare dso_local noundef i32 @_ZN11__sanitizer8OpenFileEPKcNS_14FileAccessModeEPi(ptr noundef, i32 noundef, ptr noundef) #5

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11__sanitizer15MapFileToMemoryEPKcPm(ptr noundef %0, ptr noundef %1) #5 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = call noundef i32 @_ZN11__sanitizer8OpenFileEPKcNS_14FileAccessModeEPi(ptr noundef %14, i32 noundef 0, ptr noundef null)
  store i32 %15, ptr %5, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %17 = load i32, ptr %5, align 4, !tbaa !9
  %18 = icmp ne i32 %17, -1
  %19 = zext i1 %18 to i64
  store i64 %19, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !11
  %20 = load i64, ptr %6, align 8, !tbaa !11
  %21 = load i64, ptr %7, align 8, !tbaa !11
  %22 = icmp ne i64 %20, %21
  %23 = xor i1 %22, true
  %24 = xor i1 %23, true
  %25 = xor i1 %24, true
  %26 = zext i1 %25 to i64
  %27 = call i64 @llvm.expect.i64(i64 %26, i64 0)
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %29, label %32

29:                                               ; preds = %16
  %30 = load i64, ptr %6, align 8, !tbaa !11
  %31 = load i64, ptr %7, align 8, !tbaa !11
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str.2, i32 noundef 252, ptr noundef @.str.8, i64 noundef %30, i64 noundef %31) #7
  unreachable

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

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = call noundef i64 @_ZN11__sanitizer17internal_filesizeEi(i32 noundef %35)
  store i64 %36, ptr %8, align 8, !tbaa !13
  br label %37

37:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %38 = load i64, ptr %8, align 8, !tbaa !13
  store i64 %38, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 -1, ptr %10, align 8, !tbaa !11
  %39 = load i64, ptr %9, align 8, !tbaa !11
  %40 = load i64, ptr %10, align 8, !tbaa !11
  %41 = icmp ne i64 %39, %40
  %42 = xor i1 %41, true
  %43 = xor i1 %42, true
  %44 = xor i1 %43, true
  %45 = zext i1 %44 to i64
  %46 = call i64 @llvm.expect.i64(i64 %45, i64 0)
  %47 = icmp ne i64 %46, 0
  br i1 %47, label %48, label %51

48:                                               ; preds = %37
  %49 = load i64, ptr %9, align 8, !tbaa !11
  %50 = load i64, ptr %10, align 8, !tbaa !11
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str.2, i32 noundef 254, ptr noundef @.str.9, i64 noundef %49, i64 noundef %50) #7
  unreachable

51:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %55 = load i64, ptr %8, align 8, !tbaa !13
  store i64 %55, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !11
  %56 = load i64, ptr %11, align 8, !tbaa !11
  %57 = load i64, ptr %12, align 8, !tbaa !11
  %58 = icmp ugt i64 %56, %57
  %59 = xor i1 %58, true
  %60 = xor i1 %59, true
  %61 = xor i1 %60, true
  %62 = zext i1 %61 to i64
  %63 = call i64 @llvm.expect.i64(i64 %62, i64 0)
  %64 = icmp ne i64 %63, 0
  br i1 %64, label %65, label %68

65:                                               ; preds = %54
  %66 = load i64, ptr %11, align 8, !tbaa !11
  %67 = load i64, ptr %12, align 8, !tbaa !11
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str.2, i32 noundef 255, ptr noundef @.str.10, i64 noundef %66, i64 noundef %67) #7
  unreachable

68:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = load i64, ptr %8, align 8, !tbaa !13
  %72 = call noundef i64 @_ZN11__sanitizer17GetPageSizeCachedEv()
  %73 = call noundef i64 @_ZN11__sanitizer9RoundUpToEmm(i64 noundef %71, i64 noundef %72)
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  store i64 %73, ptr %74, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = load i64, ptr %75, align 8, !tbaa !13
  %77 = load i32, ptr %5, align 4, !tbaa !9
  %78 = call noundef i64 @_ZN11__sanitizer13internal_mmapEPvmiiiy(ptr noundef null, i64 noundef %76, i32 noundef 1, i32 noundef 2, i32 noundef %77, i64 noundef 0)
  store i64 %78, ptr %13, align 8, !tbaa !13
  %79 = load i64, ptr %13, align 8, !tbaa !13
  %80 = call noundef zeroext i1 @_ZN11__sanitizer16internal_iserrorEmPi(i64 noundef %79, ptr noundef null)
  br i1 %80, label %81, label %82

81:                                               ; preds = %70
  br label %85

82:                                               ; preds = %70
  %83 = load i64, ptr %13, align 8, !tbaa !13
  %84 = inttoptr i64 %83 to ptr
  br label %85

85:                                               ; preds = %82, %81
  %86 = phi ptr [ null, %81 ], [ %84, %82 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  ret ptr %86
}

declare noundef i64 @_ZN11__sanitizer17internal_filesizeEi(i32 noundef) #2

attributes #0 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"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.2 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN11__sanitizer9RoundUpToEmm(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN11__sanitizer17GetPageSizeCachedEv() local_unnamed_addr #0

declare noundef i64 @_ZN11__sanitizer13internal_mmapEPvmiiiy(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN11__sanitizer16internal_iserrorEmPi(i64 noundef, ptr noundef) local_unnamed_addr #1

; 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 uwtable
declare dso_local noundef i32 @_ZN11__sanitizer8OpenFileEPKcNS_14FileAccessModeEPi(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11__sanitizer15MapFileToMemoryEPKcPm(ptr noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #3 {
  %3 = tail call noundef i32 @_ZN11__sanitizer8OpenFileEPKcNS_14FileAccessModeEPi(ptr noundef %0, i32 noundef 0, ptr noundef null)
  %.not = icmp eq i32 %3, -1
  br i1 %.not, label %4, label %5, !prof !5

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

5:                                                ; preds = %2
  %6 = tail call noundef i64 @_ZN11__sanitizer17internal_filesizeEi(i32 noundef %3)
  switch i64 %6, label %9 [
    i64 -1, label %7
    i64 0, label %8
  ], !prof !6

7:                                                ; preds = %5
  tail call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef nonnull @.str.2, i32 noundef 254, ptr noundef nonnull @.str.9, i64 noundef -1, i64 noundef -1) #4
  unreachable

8:                                                ; preds = %5
  tail call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef nonnull @.str.2, i32 noundef 255, ptr noundef nonnull @.str.10, i64 noundef 0, i64 noundef 0) #4
  unreachable

9:                                                ; preds = %5
  %10 = tail call noundef i64 @_ZN11__sanitizer17GetPageSizeCachedEv()
  %11 = tail call noundef i64 @_ZN11__sanitizer9RoundUpToEmm(i64 noundef %6, i64 noundef %10)
  store i64 %11, ptr %1, align 8, !tbaa !7
  %12 = tail call noundef i64 @_ZN11__sanitizer13internal_mmapEPvmiiiy(ptr noundef null, i64 noundef %11, i32 noundef 1, i32 noundef 2, i32 noundef %3, i64 noundef 0)
  %13 = tail call noundef zeroext i1 @_ZN11__sanitizer16internal_iserrorEmPi(i64 noundef %12, ptr noundef null)
  %14 = inttoptr i64 %12 to ptr
  %15 = select i1 %13, ptr null, ptr %14
  ret ptr %15
}

declare noundef i64 @_ZN11__sanitizer17internal_filesizeEi(i32 noundef) local_unnamed_addr #1

attributes #0 = { inlinehint 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 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!"branch_weights", i32 4000000, i32 2001, i32 2000}
!7 = !{!8, !8, i64 0}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}


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