; 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::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.5 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer14ThreadRegistryC2EPFPNS_17ThreadContextBaseEjEjjj(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) unnamed_addr #0 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  %11 = load ptr, ptr %6, align 8
  %12 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %13, ptr %12, align 8, !tbaa !11
  %14 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 1
  %15 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %15, ptr %14, align 8, !tbaa !17
  %16 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 2
  %17 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %17, ptr %16, align 4, !tbaa !18
  %18 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 3
  %19 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %19, ptr %18, align 8, !tbaa !19
  %20 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 4
  call void @_ZN11__sanitizer13BlockingMutexC1Ev(ptr noundef nonnull align 8 dereferenceable(88) %20)
  %21 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 5
  store i32 0, ptr %21, align 8, !tbaa !20
  %22 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 6
  store i64 0, ptr %22, align 8, !tbaa !21
  %23 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 7
  store i64 0, ptr %23, align 8, !tbaa !22
  %24 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 8
  store i64 0, ptr %24, align 8, !tbaa !23
  %25 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 9
  store i64 0, ptr %25, align 8, !tbaa !24
  %26 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 11
  %27 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 12
  %28 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 1
  %29 = load i32, ptr %28, align 8, !tbaa !17
  %30 = zext i32 %29 to i64
  %31 = mul i64 %30, 8
  %32 = call noundef ptr @_ZN11__sanitizer9MmapOrDieEmPKcb(i64 noundef %31, ptr noundef @.str.5, i1 noundef zeroext false)
  %33 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 10
  store ptr %32, ptr %33, align 8, !tbaa !25
  %34 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 11
  call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %34)
  %35 = getelementptr inbounds %"class.__sanitizer::ThreadRegistry", ptr %11, i32 0, i32 12
  call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %35)
  ret void
}

declare void @_ZN11__sanitizer13BlockingMutexC1Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #1

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

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

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 = { "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" }

!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, !6, i64 0}
!12 = !{!"_ZTSN11__sanitizer14ThreadRegistryE", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 24, !10, i64 112, !15, i64 120, !14, i64 128, !14, i64 136, !14, i64 144, !6, i64 152, !16, i64 160, !16, i64 184}
!13 = !{!"_ZTSN11__sanitizer13BlockingMutexE", !7, i64 0, !14, i64 80}
!14 = !{!"long", !7, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"_ZTSN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEEE", !14, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!12, !10, i64 8}
!18 = !{!12, !10, i64 12}
!19 = !{!12, !10, i64 16}
!20 = !{!12, !10, i64 112}
!21 = !{!12, !15, i64 120}
!22 = !{!12, !14, i64 128}
!23 = !{!12, !14, i64 136}
!24 = !{!12, !14, i64 144}
!25 = !{!12, !6, i64 152}


; 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.5 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11__sanitizer14ThreadRegistryC2EPFPNS_17ThreadContextBaseEjEjjj(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) unnamed_addr #0 align 2 {
  store ptr %1, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %2, ptr %6, align 8, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %3, ptr %7, align 4, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %4, ptr %8, align 8, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN11__sanitizer13BlockingMutexC1Ev(ptr noundef nonnull align 8 dereferenceable(88) %9)
  %10 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 0, ptr %10, align 8, !tbaa !18
  %11 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %11, i8 0, i64 32, i1 false)
  %12 = load i32, ptr %6, align 8, !tbaa !15
  %13 = zext i32 %12 to i64
  %14 = shl nuw nsw i64 %13, 3
  %15 = tail call noundef ptr @_ZN11__sanitizer9MmapOrDieEmPKcb(i64 noundef %14, ptr noundef nonnull @.str.5, i1 noundef zeroext false)
  %16 = getelementptr inbounds i8, ptr %0, i64 152
  store ptr %15, ptr %16, align 8, !tbaa !19
  %17 = getelementptr inbounds i8, ptr %0, i64 160
  tail call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %17)
  %18 = getelementptr inbounds i8, ptr %0, i64 184
  tail call void @_ZN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  ret void
}

declare void @_ZN11__sanitizer13BlockingMutexC1Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #1

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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__sanitizer14ThreadRegistryE", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 24, !10, i64 112, !13, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !7, i64 152, !14, i64 160, !14, i64 184}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSN11__sanitizer13BlockingMutexE", !8, i64 0, !12, i64 80}
!12 = !{!"long", !8, i64 0}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"_ZTSN11__sanitizer13IntrusiveListINS_17ThreadContextBaseEEE", !12, i64 0, !7, i64 8, !7, i64 16}
!15 = !{!6, !10, i64 8}
!16 = !{!6, !10, i64 12}
!17 = !{!6, !10, i64 16}
!18 = !{!6, !10, i64 112}
!19 = !{!6, !7, i64 152}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass