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

; 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::LowLevelAllocator" = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [112 x i8], align 1
@__func__._ZN11__sanitizer17LowLevelAllocator8AllocateEm = external hidden unnamed_addr constant [9 x i8], align 1
@_ZN11__sanitizerL24low_level_alloc_callbackE = external hidden global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [61 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: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11__sanitizer17LowLevelAllocator8AllocateEm(ptr noundef nonnull align 8 dereferenceable(16) %0, i64 noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %9 = load ptr, ptr %3, align 8
  %10 = load i64, ptr %4, align 8, !tbaa !9
  %11 = call noundef i64 @_ZN11__sanitizer9RoundUpToEmm(i64 noundef %10, i64 noundef 8)
  store i64 %11, ptr %4, align 8, !tbaa !9
  %12 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %16 = ptrtoint ptr %13 to i64
  %17 = ptrtoint ptr %15 to i64
  %18 = sub i64 %16, %17
  %19 = load i64, ptr %4, align 8, !tbaa !9
  %20 = icmp slt i64 %18, %19
  br i1 %20, label %21, label %42

21:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %22 = load i64, ptr %4, align 8, !tbaa !9
  %23 = call noundef i64 @_ZN11__sanitizer17GetPageSizeCachedEv()
  %24 = call noundef i64 @_ZN11__sanitizer3MaxImEET_S1_S1_(i64 noundef %22, i64 noundef %23)
  store i64 %24, ptr %5, align 8, !tbaa !9
  %25 = load i64, ptr %5, align 8, !tbaa !9
  %26 = call noundef ptr @_ZN11__sanitizer9MmapOrDieEmPKcb(i64 noundef %25, ptr noundef @__func__._ZN11__sanitizer17LowLevelAllocator8AllocateEm, i1 noundef zeroext false)
  %27 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 1
  store ptr %26, ptr %27, align 8, !tbaa !13
  %28 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = load i64, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds i8, ptr %29, i64 %30
  %32 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 0
  store ptr %31, ptr %32, align 8, !tbaa !11
  %33 = load ptr, ptr @_ZN11__sanitizerL24low_level_alloc_callbackE, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %41

35:                                               ; preds = %21
  %36 = load ptr, ptr @_ZN11__sanitizerL24low_level_alloc_callbackE, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  %39 = ptrtoint ptr %38 to i64
  %40 = load i64, ptr %5, align 8, !tbaa !9
  call void %36(i64 noundef %39, i64 noundef %40)
  br label %41

41:                                               ; preds = %35, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %42

42:                                               ; preds = %41, %2
  br label %43

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %44 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  %46 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = ptrtoint ptr %45 to i64
  %49 = ptrtoint ptr %47 to i64
  %50 = sub i64 %48, %49
  %51 = load i64, ptr %4, align 8, !tbaa !9
  %52 = icmp sge i64 %50, %51
  %53 = zext i1 %52 to i64
  store i64 %53, ptr %6, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !14
  %54 = load i64, ptr %6, align 8, !tbaa !14
  %55 = load i64, ptr %7, align 8, !tbaa !14
  %56 = icmp ne i64 %54, %55
  %57 = xor i1 %56, true
  %58 = xor i1 %57, true
  %59 = xor i1 %58, true
  %60 = zext i1 %59 to i64
  %61 = call i64 @llvm.expect.i64(i64 %60, i64 0)
  %62 = icmp ne i64 %61, 0
  br i1 %62, label %63, label %66

63:                                               ; preds = %43
  %64 = load i64, ptr %6, align 8, !tbaa !14
  %65 = load i64, ptr %7, align 8, !tbaa !14
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str, i32 noundef 195, ptr noundef @.str.2, i64 noundef %64, i64 noundef %65) #8
  unreachable

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

67:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %68 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !13
  store ptr %69, ptr %8, align 8, !tbaa !5
  %70 = load i64, ptr %4, align 8, !tbaa !9
  %71 = getelementptr inbounds %"class.__sanitizer::LowLevelAllocator", ptr %9, i32 0, i32 1
  %72 = load ptr, ptr %71, align 8, !tbaa !13
  %73 = getelementptr inbounds i8, ptr %72, i64 %70
  store ptr %73, ptr %71, align 8, !tbaa !13
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  ret ptr %74
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11__sanitizer3MaxImEET_S1_S1_(i64 noundef, i64 noundef) #5

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { 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 #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 = { "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 #7 = { nounwind }
attributes #8 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN11__sanitizer17LowLevelAllocatorE", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"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 [112 x i8], align 1
@__func__._ZN11__sanitizer17LowLevelAllocator8AllocateEm = external hidden unnamed_addr constant [9 x i8], align 1
@_ZN11__sanitizerL24low_level_alloc_callbackE = external hidden local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [61 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11__sanitizer17LowLevelAllocator8AllocateEm(ptr nocapture noundef nonnull align 8 dereferenceable(16) %0, i64 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = tail call noundef i64 @_ZN11__sanitizer9RoundUpToEmm(i64 noundef %1, i64 noundef 8)
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !10
  %7 = ptrtoint ptr %4 to i64
  %8 = ptrtoint ptr %6 to i64
  %9 = sub i64 %7, %8
  %10 = icmp slt i64 %9, %3
  br i1 %10, label %11, label %19

11:                                               ; preds = %2
  %12 = tail call noundef i64 @_ZN11__sanitizer17GetPageSizeCachedEv()
  %13 = tail call noundef i64 @_ZN11__sanitizer3MaxImEET_S1_S1_(i64 noundef %3, i64 noundef %12)
  %14 = tail call noundef ptr @_ZN11__sanitizer9MmapOrDieEmPKcb(i64 noundef %13, ptr noundef nonnull @__func__._ZN11__sanitizer17LowLevelAllocator8AllocateEm, i1 noundef zeroext false)
  store ptr %14, ptr %5, align 8, !tbaa !10
  %15 = getelementptr inbounds i8, ptr %14, i64 %13
  store ptr %15, ptr %0, align 8, !tbaa !5
  %16 = load ptr, ptr @_ZN11__sanitizerL24low_level_alloc_callbackE, align 8, !tbaa !11
  %.not = icmp eq ptr %16, null
  br i1 %.not, label %19, label %17

17:                                               ; preds = %11
  %18 = ptrtoint ptr %14 to i64
  tail call void %16(i64 noundef %18, i64 noundef %13)
  %.pre = load ptr, ptr %0, align 8, !tbaa !5
  %.pre15 = load ptr, ptr %5, align 8, !tbaa !10
  br label %19

19:                                               ; preds = %11, %17, %2
  %20 = phi ptr [ %14, %11 ], [ %.pre15, %17 ], [ %6, %2 ]
  %21 = phi ptr [ %15, %11 ], [ %.pre, %17 ], [ %4, %2 ]
  %22 = ptrtoint ptr %21 to i64
  %23 = ptrtoint ptr %20 to i64
  %24 = sub i64 %22, %23
  %.not14 = icmp slt i64 %24, %3
  br i1 %.not14, label %25, label %26, !prof !12

25:                                               ; preds = %19
  tail call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef nonnull @.str, i32 noundef 195, ptr noundef nonnull @.str.2, i64 noundef 0, i64 noundef 0) #5
  unreachable

26:                                               ; preds = %19
  %27 = getelementptr inbounds i8, ptr %20, i64 %3
  store ptr %27, ptr %5, align 8, !tbaa !10
  ret ptr %20
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11__sanitizer3MaxImEET_S1_S1_(i64 noundef, i64 noundef) local_unnamed_addr #3

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

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

attributes #0 = { 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 #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 = { 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 #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 = { "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 = { 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, !7, i64 0}
!6 = !{!"_ZTSN11__sanitizer17LowLevelAllocatorE", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!"branch_weights", !"expected", i32 1, i32 2000}


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