; LLVM IR from AngoraFuzzer/Angora :: llvm_mode/dfsan_rt/sanitizer_common (sanitizer_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"

@__func__._ZN11__sanitizer16ReadFileToBufferEPKcPPcPmS4_mPi = external hidden unnamed_addr constant [17 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

declare void @_ZN11__sanitizer9CloseFileEi(i32 noundef) #1

declare noundef i32 @_ZN11__sanitizer8OpenFileEPKcNS_14FileAccessModeEPi(ptr noundef, i32 noundef, ptr noundef) #1

; 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 noundef zeroext i1 @_ZN11__sanitizer16ReadFileToBufferEPKcPPcPmS4_mPi(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4, ptr noundef %5) #2 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i8, align 1
  %20 = alloca i64, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i64 %4, ptr %12, align 8, !tbaa !9
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %21 = call noundef i64 @_ZN11__sanitizer17GetPageSizeCachedEv()
  store i64 %21, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %22 = load i64, ptr %14, align 8, !tbaa !9
  store i64 %22, ptr %15, align 8, !tbaa !9
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %23, align 8, !tbaa !5
  %24 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 0, ptr %24, align 8, !tbaa !9
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %25, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %26 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %26, ptr %16, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %94, %6
  %28 = load i64, ptr %16, align 8, !tbaa !9
  %29 = load i64, ptr %12, align 8, !tbaa !9
  %30 = icmp ule i64 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 2, ptr %17, align 4
  br label %97

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = load ptr, ptr %13, align 8, !tbaa !5
  %35 = call noundef i32 @_ZN11__sanitizer8OpenFileEPKcNS_14FileAccessModeEPi(ptr noundef %33, i32 noundef 0, ptr noundef %34)
  store i32 %35, ptr %18, align 4, !tbaa !11
  %36 = load i32, ptr %18, align 4, !tbaa !11
  %37 = icmp eq i32 %36, -1
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  store i1 false, ptr %7, align 1
  store i32 1, ptr %17, align 4
  br label %91

39:                                               ; preds = %32
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = load i64, ptr %42, align 8, !tbaa !9
  call void @_ZN11__sanitizer10UnmapOrDieEPvm(ptr noundef %41, i64 noundef %43)
  %44 = load i64, ptr %16, align 8, !tbaa !9
  %45 = call noundef ptr @_ZN11__sanitizer9MmapOrDieEmPKcb(i64 noundef %44, ptr noundef @__func__._ZN11__sanitizer16ReadFileToBufferEPKcPPcPmS4_mPi, i1 noundef zeroext false)
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %45, ptr %46, align 8, !tbaa !5
  %47 = load i64, ptr %16, align 8, !tbaa !9
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 %47, ptr %48, align 8, !tbaa !9
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %49, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #4
  store i8 0, ptr %19, align 1, !tbaa !13
  br label %50

50:                                               ; preds = %83, %39
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = load i64, ptr %14, align 8, !tbaa !9
  %54 = add i64 %52, %53
  %55 = load i64, ptr %16, align 8, !tbaa !9
  %56 = icmp ule i64 %54, %55
  br i1 %56, label %57, label %84

57:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %58 = load i32, ptr %18, align 4, !tbaa !11
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = getelementptr inbounds i8, ptr %60, i64 %62
  %64 = load i64, ptr %14, align 8, !tbaa !9
  %65 = load ptr, ptr %13, align 8, !tbaa !5
  %66 = call noundef zeroext i1 @_ZN11__sanitizer12ReadFromFileEiPvmPmPi(i32 noundef %58, ptr noundef %63, i64 noundef %64, ptr noundef %20, ptr noundef %65)
  br i1 %66, label %72, label %67

67:                                               ; preds = %57
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = load i64, ptr %70, align 8, !tbaa !9
  call void @_ZN11__sanitizer10UnmapOrDieEPvm(ptr noundef %69, i64 noundef %71)
  store i1 false, ptr %7, align 1
  store i32 1, ptr %17, align 4
  br label %81

72:                                               ; preds = %57
  %73 = load i64, ptr %20, align 8, !tbaa !9
  %74 = icmp eq i64 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %72
  store i8 1, ptr %19, align 1, !tbaa !13
  store i32 6, ptr %17, align 4
  br label %81

76:                                               ; preds = %72
  %77 = load i64, ptr %20, align 8, !tbaa !9
  %78 = load ptr, ptr %11, align 8, !tbaa !5
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = add i64 %79, %77
  store i64 %80, ptr %78, align 8, !tbaa !9
  store i32 0, ptr %17, align 4
  br label %81

81:                                               ; preds = %76, %75, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  %82 = load i32, ptr %17, align 4
  switch i32 %82, label %90 [
    i32 0, label %83
    i32 6, label %84
  ]

83:                                               ; preds = %81
  br label %50, !llvm.loop !15

84:                                               ; preds = %81, %50
  %85 = load i32, ptr %18, align 4, !tbaa !11
  call void @_ZN11__sanitizer9CloseFileEi(i32 noundef %85)
  %86 = load i8, ptr %19, align 1, !tbaa !13, !range !17, !noundef !18
  %87 = trunc i8 %86 to i1
  br i1 %87, label %88, label %89

88:                                               ; preds = %84
  store i32 2, ptr %17, align 4
  br label %90

89:                                               ; preds = %84
  store i32 0, ptr %17, align 4
  br label %90

90:                                               ; preds = %89, %88, %81
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #4
  br label %91

91:                                               ; preds = %90, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  %92 = load i32, ptr %17, align 4
  switch i32 %92, label %97 [
    i32 0, label %93
  ]

93:                                               ; preds = %91
  br label %94

94:                                               ; preds = %93
  %95 = load i64, ptr %16, align 8, !tbaa !9
  %96 = mul i64 %95, 2
  store i64 %96, ptr %16, align 8, !tbaa !9
  br label %27, !llvm.loop !19

97:                                               ; preds = %91, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  %98 = load i32, ptr %17, align 4
  switch i32 %98, label %100 [
    i32 2, label %99
  ]

99:                                               ; preds = %97
  store i1 true, ptr %7, align 1
  store i32 1, ptr %17, align 4
  br label %100

100:                                              ; preds = %99, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %101 = load i1, ptr %7, align 1
  ret i1 %101
}

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

declare void @_ZN11__sanitizer10UnmapOrDieEPvm(ptr noundef, i64 noundef) #1

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

declare noundef zeroext i1 @_ZN11__sanitizer12ReadFromFileEiPvmPmPi(i32 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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 #4 = { nounwind }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !16}


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

@__func__._ZN11__sanitizer16ReadFileToBufferEPKcPPcPmS4_mPi = external hidden unnamed_addr constant [17 x i8], align 1

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

declare void @_ZN11__sanitizer9CloseFileEi(i32 noundef) local_unnamed_addr #1

declare noundef i32 @_ZN11__sanitizer8OpenFileEPKcNS_14FileAccessModeEPi(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress 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 noundef zeroext i1 @_ZN11__sanitizer16ReadFileToBufferEPKcPPcPmS4_mPi(ptr noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3, i64 noundef %4, ptr noundef %5) local_unnamed_addr #2 {
  %7 = alloca i64, align 8
  %8 = tail call noundef i64 @_ZN11__sanitizer17GetPageSizeCachedEv()
  store ptr null, ptr %1, align 8, !tbaa !5
  store i64 0, ptr %2, align 8, !tbaa !9
  store i64 0, ptr %3, align 8, !tbaa !9
  %.not58 = icmp ugt i64 %8, %4
  br i1 %.not58, label %.thread51, label %.lr.ph61

.lr.ph61:                                         ; preds = %6, %._crit_edge
  %.04259 = phi i64 [ %28, %._crit_edge ], [ %8, %6 ]
  %9 = call noundef i32 @_ZN11__sanitizer8OpenFileEPKcNS_14FileAccessModeEPi(ptr noundef %0, i32 noundef 0, ptr noundef %5)
  %10 = icmp ne i32 %9, -1
  br i1 %10, label %11, label %.thread51

11:                                               ; preds = %.lr.ph61
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = load i64, ptr %2, align 8, !tbaa !9
  call void @_ZN11__sanitizer10UnmapOrDieEPvm(ptr noundef %12, i64 noundef %13)
  %14 = call noundef ptr @_ZN11__sanitizer9MmapOrDieEmPKcb(i64 noundef %.04259, ptr noundef nonnull @__func__._ZN11__sanitizer16ReadFileToBufferEPKcPPcPmS4_mPi, i1 noundef zeroext false)
  store ptr %14, ptr %1, align 8, !tbaa !5
  store i64 %.04259, ptr %2, align 8, !tbaa !9
  store i64 0, ptr %3, align 8, !tbaa !9
  %.not4557 = icmp ugt i64 %8, %.04259
  br i1 %.not4557, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %11, %24
  %15 = phi i64 [ %26, %24 ], [ 0, %11 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %16 = load ptr, ptr %1, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 %15
  %18 = call noundef zeroext i1 @_ZN11__sanitizer12ReadFromFileEiPvmPmPi(i32 noundef %9, ptr noundef %17, i64 noundef %8, ptr noundef nonnull %7, ptr noundef %5)
  br i1 %18, label %21, label %.thread

.thread:                                          ; preds = %.lr.ph
  %19 = load ptr, ptr %1, align 8, !tbaa !5
  %20 = load i64, ptr %2, align 8, !tbaa !9
  call void @_ZN11__sanitizer10UnmapOrDieEPvm(ptr noundef %19, i64 noundef %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %.thread51

21:                                               ; preds = %.lr.ph
  %22 = load i64, ptr %7, align 8, !tbaa !9
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %.thread54, label %24

.thread54:                                        ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @_ZN11__sanitizer9CloseFileEi(i32 noundef %9)
  br label %.thread51

24:                                               ; preds = %21
  %25 = load i64, ptr %3, align 8, !tbaa !9
  %26 = add i64 %25, %22
  store i64 %26, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  %27 = add i64 %26, %8
  %.not45 = icmp ugt i64 %27, %.04259
  br i1 %.not45, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %24, %11
  call void @_ZN11__sanitizer9CloseFileEi(i32 noundef %9)
  %28 = shl i64 %.04259, 1
  %.not = icmp ugt i64 %28, %4
  br i1 %.not, label %.thread51, label %.lr.ph61, !llvm.loop !11

.thread51:                                        ; preds = %._crit_edge, %.lr.ph61, %6, %.thread54, %.thread
  %cond = phi i1 [ false, %.thread ], [ true, %.thread54 ], [ true, %6 ], [ %10, %._crit_edge ], [ false, %.lr.ph61 ]
  ret i1 %cond
}

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

declare void @_ZN11__sanitizer10UnmapOrDieEPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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 #4 = { nounwind }

!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 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass