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

@.str = external hidden unnamed_addr constant [112 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 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
declare dso_local noundef ptr @_ZN11__sanitizer13InternalAllocEmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES5_EEEEm(i64 noundef, ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11__sanitizer15InternalReallocEPvmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES6_EEEE(ptr noundef %0, i64 noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %18, label %14

14:                                               ; preds = %3
  %15 = load i64, ptr %6, align 8, !tbaa !9
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = call noundef ptr @_ZN11__sanitizer13InternalAllocEmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES5_EEEEm(i64 noundef %15, ptr noundef %16, i64 noundef 0)
  store ptr %17, ptr %4, align 8
  br label %58

18:                                               ; preds = %3
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = add i64 %19, 8
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = icmp ult i64 %20, %21
  br i1 %22, label %23, label %24

23:                                               ; preds = %18
  store ptr null, ptr %4, align 8
  br label %58

24:                                               ; preds = %18
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 -8
  store ptr %26, ptr %5, align 8, !tbaa !5
  %27 = load i64, ptr %6, align 8, !tbaa !9
  %28 = add i64 %27, 8
  store i64 %28, ptr %6, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 7668698031829270593, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds i64, ptr %30, i64 0
  %32 = load i64, ptr %31, align 8, !tbaa !11
  store i64 %32, ptr %9, align 8, !tbaa !11
  %33 = load i64, ptr %8, align 8, !tbaa !11
  %34 = load i64, ptr %9, align 8, !tbaa !11
  %35 = icmp eq i64 %33, %34
  %36 = xor i1 %35, true
  %37 = xor i1 %36, true
  %38 = xor i1 %37, true
  %39 = zext i1 %38 to i64
  %40 = call i64 @llvm.expect.i64(i64 %39, i64 0)
  %41 = icmp ne i64 %40, 0
  br i1 %41, label %42, label %45

42:                                               ; preds = %29
  %43 = load i64, ptr %8, align 8, !tbaa !11
  %44 = load i64, ptr %9, align 8, !tbaa !11
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str, i32 noundef 155, ptr noundef @.str.1, i64 noundef %43, i64 noundef %44) #5
  unreachable

45:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %46

46:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load i64, ptr %6, align 8, !tbaa !9
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = call noundef ptr @_ZN11__sanitizerL18RawInternalReallocEPvmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES6_EEEE(ptr noundef %47, i64 noundef %48, ptr noundef %49)
  store ptr %50, ptr %10, align 8, !tbaa !5
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %54, label %53

53:                                               ; preds = %46
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %57

54:                                               ; preds = %46
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  store ptr %56, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %57

57:                                               ; preds = %54, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %58

58:                                               ; preds = %57, %23, %14
  %59 = load ptr, ptr %4, align 8
  ret ptr %59
}

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN11__sanitizerL18RawInternalReallocEPvmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES6_EEEE(ptr noundef, i64 noundef, ptr noundef) #1

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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #3 = { 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 #4 = { nounwind }
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, !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 = !{!"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
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11__sanitizer15InternalReallocEPvmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES6_EEEE(ptr noundef %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %6

4:                                                ; preds = %3
  %5 = tail call noundef ptr @_ZN11__sanitizer13InternalAllocEmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES5_EEEEm(i64 noundef %1, ptr noundef %2, i64 noundef 0)
  br label %16

6:                                                ; preds = %3
  %7 = add i64 %1, 8
  %8 = icmp ugt i64 %1, -9
  br i1 %8, label %16, label %9

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 -8
  %11 = load i64, ptr %10, align 8, !tbaa !5
  %.not20 = icmp eq i64 %11, 7668698031829270593
  br i1 %.not20, label %13, label %12, !prof !9

12:                                               ; preds = %9
  tail call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef nonnull @.str, i32 noundef 155, ptr noundef nonnull @.str.1, i64 noundef 7668698031829270593, i64 noundef %11) #2
  unreachable

13:                                               ; preds = %9
  %14 = tail call noundef ptr @_ZN11__sanitizerL18RawInternalReallocEPvmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES6_EEEE(ptr noundef nonnull %10, i64 noundef %7, ptr noundef %2)
  %.not21 = icmp eq ptr %14, null
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %.0 = select i1 %.not21, ptr null, ptr %15
  br label %16

16:                                               ; preds = %6, %13, %4
  %.1 = phi ptr [ %.0, %13 ], [ %5, %4 ], [ null, %6 ]
  ret ptr %.1
}

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

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN11__sanitizerL18RawInternalReallocEPvmPNS_28SizeClassAllocatorLocalCacheINS_20SizeClassAllocator32ILm0ELy140737488355328ELm0ENS_12SizeClassMapILm3ELm4ELm8ELm17ELm64ELm14EEELm20ENS_15TwoLevelByteMapILy32768ELy4096ENS_20NoOpMapUnmapCallbackEEES6_EEEE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

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


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