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

; 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::ThreadLister" = type <{ i32, i32, %"class.__sanitizer::InternalScopedBuffer", i8, [7 x i8], ptr, i32, [4 x i8] }>
%"class.__sanitizer::InternalScopedBuffer" = type { ptr, i64 }
%"class.__sanitizer::ThreadSuspender" = type <{ ptr, %"class.__sanitizer::SuspendedThreadsList", i32, [4 x i8] }>
%"class.__sanitizer::SuspendedThreadsList" = type { %"class.__sanitizer::InternalMmapVector" }
%"class.__sanitizer::InternalMmapVector" = type { %"class.__sanitizer::InternalMmapVectorNoCtor" }
%"class.__sanitizer::InternalMmapVectorNoCtor" = type { ptr, i64, i64 }

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN11__sanitizer15ThreadSuspender13SuspendThreadEi(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer15ThreadSuspender16ResumeAllThreadsEv(ptr noundef nonnull align 8 dereferenceable(36)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11__sanitizer15ThreadSuspender17SuspendAllThreadsEv(ptr noundef nonnull align 8 dereferenceable(36) %0) #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca %"class.__sanitizer::ThreadLister", align 8
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr %4) #4
  %12 = getelementptr inbounds %"class.__sanitizer::ThreadSuspender", ptr %11, i32 0, i32 2
  %13 = load i32, ptr %12, align 8, !tbaa !9
  call void @_ZN11__sanitizer12ThreadListerC1Ei(ptr noundef nonnull align 8 dereferenceable(44) %4, i32 noundef %13)
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  store i8 1, ptr %6, align 1, !tbaa !16
  br label %14

14:                                               ; preds = %48, %1
  store i8 0, ptr %5, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %15 = invoke noundef i32 @_ZN11__sanitizer12ThreadLister10GetNextTIDEv(ptr noundef nonnull align 8 dereferenceable(44) %4)
          to label %16 unwind label %25

16:                                               ; preds = %14
  store i32 %15, ptr %7, align 4, !tbaa !18
  br label %17

17:                                               ; preds = %31, %16
  %18 = load i32, ptr %7, align 4, !tbaa !18
  %19 = icmp sge i32 %18, 0
  br i1 %19, label %20, label %32

20:                                               ; preds = %17
  %21 = load i32, ptr %7, align 4, !tbaa !18
  %22 = invoke noundef zeroext i1 @_ZN11__sanitizer15ThreadSuspender13SuspendThreadEi(ptr noundef nonnull align 8 dereferenceable(36) %11, i32 noundef %21)
          to label %23 unwind label %25

23:                                               ; preds = %20
  br i1 %22, label %24, label %29

24:                                               ; preds = %23
  store i8 1, ptr %5, align 1, !tbaa !16
  br label %29

25:                                               ; preds = %43, %41, %32, %29, %20, %14
  %26 = landingpad { ptr, i32 }
          cleanup
  %27 = extractvalue { ptr, i32 } %26, 0
  store ptr %27, ptr %8, align 8
  %28 = extractvalue { ptr, i32 } %26, 1
  store i32 %28, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  call void @_ZN11__sanitizer12ThreadListerD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %4) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #4
  br label %54

29:                                               ; preds = %24, %23
  %30 = invoke noundef i32 @_ZN11__sanitizer12ThreadLister10GetNextTIDEv(ptr noundef nonnull align 8 dereferenceable(44) %4)
          to label %31 unwind label %25

31:                                               ; preds = %29
  store i32 %30, ptr %7, align 4, !tbaa !18
  br label %17, !llvm.loop !19

32:                                               ; preds = %17
  %33 = invoke noundef zeroext i1 @_ZN11__sanitizer12ThreadLister5errorEv(ptr noundef nonnull align 8 dereferenceable(44) %4)
          to label %34 unwind label %25

34:                                               ; preds = %32
  br i1 %33, label %41, label %35

35:                                               ; preds = %34
  %36 = load i8, ptr %6, align 1, !tbaa !16, !range !21, !noundef !22
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %43

38:                                               ; preds = %35
  %39 = load i8, ptr %5, align 1, !tbaa !16, !range !21, !noundef !22
  %40 = trunc i8 %39 to i1
  br i1 %40, label %43, label %41

41:                                               ; preds = %38, %34
  invoke void @_ZN11__sanitizer15ThreadSuspender16ResumeAllThreadsEv(ptr noundef nonnull align 8 dereferenceable(36) %11)
          to label %42 unwind label %25

42:                                               ; preds = %41
  store i1 false, ptr %2, align 1
  store i32 1, ptr %10, align 4
  br label %45

43:                                               ; preds = %38, %35
  invoke void @_ZN11__sanitizer12ThreadLister5ResetEv(ptr noundef nonnull align 8 dereferenceable(44) %4)
          to label %44 unwind label %25

44:                                               ; preds = %43
  store i8 0, ptr %6, align 1, !tbaa !16
  store i32 0, ptr %10, align 4
  br label %45

45:                                               ; preds = %44, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %46 = load i32, ptr %10, align 4
  switch i32 %46, label %52 [
    i32 0, label %47
  ]

47:                                               ; preds = %45
  br label %48

48:                                               ; preds = %47
  %49 = load i8, ptr %5, align 1, !tbaa !16, !range !21, !noundef !22
  %50 = trunc i8 %49 to i1
  br i1 %50, label %14, label %51, !llvm.loop !23

51:                                               ; preds = %48
  store i1 true, ptr %2, align 1
  store i32 1, ptr %10, align 4
  br label %52

52:                                               ; preds = %51, %45
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  call void @_ZN11__sanitizer12ThreadListerD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %4) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #4
  %53 = load i1, ptr %2, align 1
  ret i1 %53

54:                                               ; preds = %25
  %55 = load ptr, ptr %8, align 8
  %56 = load i32, ptr %9, align 4
  %57 = insertvalue { ptr, i32 } poison, ptr %55, 0
  %58 = insertvalue { ptr, i32 } %57, i32 %56, 1
  resume { ptr, i32 } %58
}

declare void @_ZN11__sanitizer12ThreadListerC1Ei(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef) unnamed_addr #2

declare noundef i32 @_ZN11__sanitizer12ThreadLister10GetNextTIDEv(ptr noundef nonnull align 8 dereferenceable(44)) #2

declare i32 @__gxx_personality_v0(...)

declare noundef zeroext i1 @_ZN11__sanitizer12ThreadLister5errorEv(ptr noundef nonnull align 8 dereferenceable(44)) #2

declare void @_ZN11__sanitizer12ThreadLister5ResetEv(ptr noundef nonnull align 8 dereferenceable(44)) #2

; Function Attrs: nounwind
declare void @_ZN11__sanitizer12ThreadListerD1Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { nounwind "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, !15, i64 32}
!10 = !{!"_ZTSN11__sanitizer15ThreadSuspenderE", !6, i64 0, !11, i64 8, !15, i64 32}
!11 = !{!"_ZTSN11__sanitizer20SuspendedThreadsListE", !12, i64 0}
!12 = !{!"_ZTSN11__sanitizer18InternalMmapVectorIiEE", !13, i64 0}
!13 = !{!"_ZTSN11__sanitizer24InternalMmapVectorNoCtorIiEE", !6, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!15, !15, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = distinct !{!23, !20}


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

%"class.__sanitizer::ThreadLister" = type <{ i32, i32, %"class.__sanitizer::InternalScopedBuffer", i8, [7 x i8], ptr, i32, [4 x i8] }>
%"class.__sanitizer::InternalScopedBuffer" = type { ptr, i64 }

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN11__sanitizer15ThreadSuspender13SuspendThreadEi(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11__sanitizer15ThreadSuspender16ResumeAllThreadsEv(ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN11__sanitizer15ThreadSuspender17SuspendAllThreadsEv(ptr noundef nonnull align 8 dereferenceable(36) %0) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.__sanitizer::ThreadLister", align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #4
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load i32, ptr %3, align 8, !tbaa !5
  call void @_ZN11__sanitizer12ThreadListerC1Ei(ptr noundef nonnull align 8 dereferenceable(44) %2, i32 noundef %4)
  br label %5

5:                                                ; preds = %20, %1
  %.013 = phi i1 [ true, %1 ], [ false, %20 ]
  %6 = invoke noundef i32 @_ZN11__sanitizer12ThreadLister10GetNextTIDEv(ptr noundef nonnull align 8 dereferenceable(44) %2)
          to label %.preheader unwind label %.loopexit.split-lp.loopexit

.preheader:                                       ; preds = %5, %10
  %.012 = phi i32 [ %11, %10 ], [ %6, %5 ]
  %.010 = phi i8 [ %spec.select, %10 ], [ 0, %5 ]
  %7 = icmp sgt i32 %.012, -1
  br i1 %7, label %8, label %12

8:                                                ; preds = %.preheader
  %9 = invoke noundef zeroext i1 @_ZN11__sanitizer15ThreadSuspender13SuspendThreadEi(ptr noundef nonnull align 8 dereferenceable(36) %0, i32 noundef %.012)
          to label %10 unwind label %.loopexit

10:                                               ; preds = %8
  %spec.select = select i1 %9, i8 1, i8 %.010
  %11 = invoke noundef i32 @_ZN11__sanitizer12ThreadLister10GetNextTIDEv(ptr noundef nonnull align 8 dereferenceable(44) %2)
          to label %.preheader unwind label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %8, %10
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit:                      ; preds = %19, %12, %5
  %lpad.loopexit20 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp:             ; preds = %18
  %lpad.loopexit.split-lp21 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp:                               ; preds = %.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit20, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp21, %.loopexit.split-lp.loopexit.split-lp ]
  call void @_ZN11__sanitizer12ThreadListerD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %2) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #4
  resume { ptr, i32 } %lpad.phi

12:                                               ; preds = %.preheader
  %13 = invoke noundef zeroext i1 @_ZN11__sanitizer12ThreadLister5errorEv(ptr noundef nonnull align 8 dereferenceable(44) %2)
          to label %14 unwind label %.loopexit.split-lp.loopexit

14:                                               ; preds = %12
  br i1 %13, label %18, label %15

15:                                               ; preds = %14
  br i1 %.013, label %16, label %19

16:                                               ; preds = %15
  %17 = trunc nuw i8 %.010 to i1
  br i1 %17, label %19, label %18

18:                                               ; preds = %16, %14
  invoke void @_ZN11__sanitizer15ThreadSuspender16ResumeAllThreadsEv(ptr noundef nonnull align 8 dereferenceable(36) %0)
          to label %.loopexit23 unwind label %.loopexit.split-lp.loopexit.split-lp

19:                                               ; preds = %16, %15
  invoke void @_ZN11__sanitizer12ThreadLister5ResetEv(ptr noundef nonnull align 8 dereferenceable(44) %2)
          to label %20 unwind label %.loopexit.split-lp.loopexit

20:                                               ; preds = %19
  %21 = trunc nuw i8 %.010 to i1
  br i1 %21, label %5, label %.loopexit23, !llvm.loop !17

.loopexit23:                                      ; preds = %20, %18
  %cond18 = phi i1 [ false, %18 ], [ true, %20 ]
  call void @_ZN11__sanitizer12ThreadListerD1Ev(ptr noundef nonnull align 8 dereferenceable(44) %2) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #4
  ret i1 %cond18
}

declare void @_ZN11__sanitizer12ThreadListerC1Ei(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef) unnamed_addr #2

declare noundef i32 @_ZN11__sanitizer12ThreadLister10GetNextTIDEv(ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare noundef zeroext i1 @_ZN11__sanitizer12ThreadLister5errorEv(ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #2

declare void @_ZN11__sanitizer12ThreadLister5ResetEv(ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN11__sanitizer12ThreadListerD1Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { nounwind "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, !14, i64 32}
!6 = !{!"_ZTSN11__sanitizer15ThreadSuspenderE", !7, i64 0, !10, i64 8, !14, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN11__sanitizer20SuspendedThreadsListE", !11, i64 0}
!11 = !{!"_ZTSN11__sanitizer18InternalMmapVectorIiEE", !12, i64 0}
!12 = !{!"_ZTSN11__sanitizer24InternalMmapVectorNoCtorIiEE", !7, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"long", !8, i64 0}
!14 = !{!"int", !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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