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

; 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::ThreadContextBase" = type { ptr, i32, i64, i32, i64, i64, [64 x i8], i32, i8, i32, ptr }
%"class.__sanitizer::ThreadRegistry" = type { ptr, i32, i32, i32, %"class.__sanitizer::BlockingMutex", i32, i64, i64, i64, i64, ptr, %"struct.__sanitizer::IntrusiveList", %"struct.__sanitizer::IntrusiveList" }
%"class.__sanitizer::BlockingMutex" = type { [10 x i64], i64 }
%"struct.__sanitizer::IntrusiveList" = type { i64, ptr, ptr }

@.str = external hidden unnamed_addr constant [118 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [41 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(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: 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 void @_ZN11__sanitizer17ThreadContextBase5ResetEv(ptr noundef nonnull align 8 dereferenceable(136)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer14ThreadRegistry14QuarantinePushEPNS_17ThreadContextBaseE(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %"class.__sanitizer::ThreadContextBase", ptr %8, i32 0, i32 1
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  br label %65

13:                                               ; preds = %2
  %14 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %7, i32 0, i32 11
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9push_backEPS1_(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef %15)
  %16 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %7, i32 0, i32 11
  %17 = call noundef i64 @_ZNK11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16)
  %18 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %7, i32 0, i32 2
  %19 = load i32, ptr %18, align 4, !tbaa !16
  %20 = zext i32 %19 to i64
  %21 = icmp ule i64 %17, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %13
  br label %65

23:                                               ; preds = %13
  %24 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %7, i32 0, i32 11
  %25 = call noundef ptr @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %24)
  store ptr %25, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %7, i32 0, i32 11
  call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(24) %26)
  br label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.__sanitizer::ThreadContextBase", ptr %28, i32 0, i32 7
  %30 = load i32, ptr %29, align 8, !tbaa !20
  %31 = zext i32 %30 to i64
  store i64 %31, ptr %5, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 4, ptr %6, align 8, !tbaa !21
  %32 = load i64, ptr %5, align 8, !tbaa !21
  %33 = load i64, ptr %6, align 8, !tbaa !21
  %34 = icmp eq i64 %32, %33
  %35 = xor i1 %34, true
  %36 = xor i1 %35, true
  %37 = xor i1 %36, true
  %38 = zext i1 %37 to i64
  %39 = call i64 @llvm.expect.i64(i64 %38, i64 0)
  %40 = icmp ne i64 %39, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %27
  %42 = load i64, ptr %5, align 8, !tbaa !21
  %43 = load i64, ptr %6, align 8, !tbaa !21
  call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef @.str, i32 noundef 287, ptr noundef @.str.19, i64 noundef %42, i64 noundef %43) #6
  unreachable

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

45:                                               ; preds = %44
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11__sanitizer17ThreadContextBase5ResetEv(ptr noundef nonnull align 8 dereferenceable(136) %46)
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.__sanitizer::ThreadContextBase", ptr %47, i32 0, i32 3
  %49 = load i32, ptr %48, align 8, !tbaa !22
  %50 = add i32 %49, 1
  store i32 %50, ptr %48, align 8, !tbaa !22
  %51 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %7, i32 0, i32 3
  %52 = load i32, ptr %51, align 8, !tbaa !23
  %53 = icmp ugt i32 %52, 0
  br i1 %53, label %54, label %62

54:                                               ; preds = %45
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %"class.__sanitizer::ThreadContextBase", ptr %55, i32 0, i32 3
  %57 = load i32, ptr %56, align 8, !tbaa !22
  %58 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %7, i32 0, i32 3
  %59 = load i32, ptr %58, align 8, !tbaa !23
  %60 = icmp uge i32 %57, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %54
  br label %65

62:                                               ; preds = %54, %45
  %63 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %7, i32 0, i32 12
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9push_backEPS1_(ptr noundef nonnull align 8 dereferenceable(24) %63, ptr noundef %64)
  br label %65

65:                                               ; preds = %62, %61, %22, %12
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9push_backEPS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE5frontEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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 = { 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 #5 = { nounwind }
attributes #6 = { 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, !11, i64 8}
!10 = !{!"_ZTSN11__sanitizer17ThreadContextBaseE", !11, i64 8, !12, i64 16, !11, i64 24, !13, i64 32, !13, i64 40, !7, i64 48, !14, i64 112, !15, i64 116, !11, i64 120, !6, i64 128}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN11__sanitizer12ThreadStatusE", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!17, !11, i64 12}
!17 = !{!"_ZTSN11__sanitizer14ThreadRegistryE", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !18, i64 24, !11, i64 112, !12, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !6, i64 152, !19, i64 160, !19, i64 184}
!18 = !{!"_ZTSN11__sanitizer13BlockingMutexE", !7, i64 0, !13, i64 80}
!19 = !{!"_ZTSN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEEE", !13, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!10, !14, i64 112}
!21 = !{!12, !12, i64 0}
!22 = !{!10, !11, i64 24}
!23 = !{!17, !11, i64 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"

@.str = external hidden unnamed_addr constant [118 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [41 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
declare dso_local void @_ZN11__sanitizer17ThreadContextBase5ResetEv(ptr noundef nonnull align 8 dereferenceable(136)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer14ThreadRegistry14QuarantinePushEPNS_17ThreadContextBaseE(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i32 %4, 0
  br i1 %5, label %27, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 160
  tail call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9push_backEPS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull %1)
  %8 = tail call noundef i64 @_ZNK11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  %10 = load i32, ptr %9, align 4, !tbaa !15
  %11 = zext i32 %10 to i64
  %.not = icmp ugt i64 %8, %11
  br i1 %.not, label %12, label %27

12:                                               ; preds = %6
  %13 = tail call noundef ptr @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  tail call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
  %14 = getelementptr inbounds i8, ptr %13, i64 112
  %15 = load i32, ptr %14, align 8, !tbaa !19
  %.not11 = icmp eq i32 %15, 4
  br i1 %.not11, label %18, label %16, !prof !20

16:                                               ; preds = %12
  %17 = zext i32 %15 to i64
  tail call void @_ZN11__sanitizer11CheckFailedEPKciS1_yy(ptr noundef nonnull @.str, i32 noundef 287, ptr noundef nonnull @.str.19, i64 noundef %17, i64 noundef 4) #3
  unreachable

18:                                               ; preds = %12
  tail call void @_ZN11__sanitizer17ThreadContextBase5ResetEv(ptr noundef nonnull align 8 dereferenceable(136) %13)
  %19 = getelementptr inbounds i8, ptr %13, i64 24
  %20 = load i32, ptr %19, align 8, !tbaa !21
  %.fr = freeze i32 %20
  %21 = add i32 %.fr, 1
  store i32 %21, ptr %19, align 8, !tbaa !21
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  %23 = load i32, ptr %22, align 8, !tbaa !22
  %24 = add i32 %23, -1
  %or.cond.not = icmp ult i32 %24, %21
  br i1 %or.cond.not, label %27, label %25

25:                                               ; preds = %18
  %26 = getelementptr inbounds i8, ptr %0, i64 184
  tail call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9push_backEPS1_(ptr noundef nonnull align 8 dereferenceable(24) %26, ptr noundef nonnull %13)
  br label %27

27:                                               ; preds = %18, %6, %2, %25
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE9push_backEPS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE5frontEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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 = { 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 #3 = { 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 8}
!6 = !{!"_ZTSN11__sanitizer17ThreadContextBaseE", !7, i64 8, !10, i64 16, !7, i64 24, !11, i64 32, !11, i64 40, !8, i64 48, !12, i64 112, !13, i64 116, !7, i64 120, !14, i64 128}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long long", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_ZTSN11__sanitizer12ThreadStatusE", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!16, !7, i64 12}
!16 = !{!"_ZTSN11__sanitizer14ThreadRegistryE", !14, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !17, i64 24, !7, i64 112, !10, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !14, i64 152, !18, i64 160, !18, i64 184}
!17 = !{!"_ZTSN11__sanitizer13BlockingMutexE", !8, i64 0, !11, i64 80}
!18 = !{!"_ZTSN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEEE", !11, i64 0, !14, i64 8, !14, i64 16}
!19 = !{!6, !12, i64 112}
!20 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!21 = !{!6, !7, i64 24}
!22 = !{!16, !7, i64 16}


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