; LLVM IR from turi-code/SFrame :: oss_src/sframe/unfair_lock.ll (ZN8graphlab11unfair_lock4lockEv)

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

%"struct.std::_Rb_tree_iterator" = type { ptr }
%"class.graphlab::unfair_lock" = type { %"class.graphlab::mutex", %"class.graphlab::mutex", i8, %"class.std::map", i64, i32, double, i32, double, i64, i8, %"class.graphlab::timer" }
%"class.graphlab::mutex" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, graphlab::conditional *>, std::_Select1st<std::pair<const unsigned long, graphlab::conditional *>>, std::less<unsigned long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned long, std::pair<const unsigned long, graphlab::conditional *>, std::_Select1st<std::pair<const unsigned long, graphlab::conditional *>>, std::less<unsigned long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.graphlab::timer" = type { %struct.timeval }
%struct.timeval = type { i64, i64 }
%"struct.std::pair" = type { i64, ptr }
%"struct.graphlab::(anonymous namespace)::unfair_lock_priority" = type { i64, %"class.graphlab::conditional" }
%"class.graphlab::conditional" = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }

; 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
define dso_local void @_ZN8graphlab11unfair_lock4lockEv(ptr noundef nonnull align 8 dereferenceable(208) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %7 = call noundef ptr @_ZN8graphlab12_GLOBAL__N_124get_unfair_lock_priorityEv()
  store ptr %7, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 1
  call void @_ZNK8graphlab5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %8)
  %9 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 2
  %10 = load volatile i8, ptr %9, align 8, !tbaa !9, !range !26, !noundef !27
  %11 = trunc i8 %10 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  br i1 %11, label %29, label %12

12:                                               ; preds = %1
  %13 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 3
  %14 = call noundef i64 @_ZNKSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %13) #5
  %15 = icmp ugt i64 %14, 0
  br i1 %15, label %16, label %27

16:                                               ; preds = %12
  %17 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 3
  %18 = call ptr @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %17) #5
  %19 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %4, i32 0, i32 0
  store ptr %18, ptr %19, align 8
  %20 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmPN8graphlab11conditionalEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %21 = getelementptr inbounds %"struct.std::pair", ptr %20, i32 0, i32 0
  %22 = load i64, ptr %21, align 8, !tbaa !28
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.graphlab::(anonymous namespace)::unfair_lock_priority", ptr %23, i32 0, i32 0
  %25 = load i64, ptr %24, align 8, !tbaa !30
  %26 = icmp ult i64 %22, %25
  br label %27

27:                                               ; preds = %16, %12
  %28 = phi i1 [ false, %12 ], [ %26, %16 ]
  br label %29

29:                                               ; preds = %27, %1
  %30 = phi i1 [ true, %1 ], [ %28, %27 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br i1 %30, label %31, label %83

31:                                               ; preds = %29
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.graphlab::(anonymous namespace)::unfair_lock_priority", ptr %32, i32 0, i32 1
  %34 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 3
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.graphlab::(anonymous namespace)::unfair_lock_priority", ptr %35, i32 0, i32 0
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEEixERS6_(ptr noundef nonnull align 8 dereferenceable(48) %34, ptr noundef nonnull align 8 dereferenceable(8) %36)
  store ptr %33, ptr %37, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %77, %31
  %39 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 2
  %40 = load volatile i8, ptr %39, align 8, !tbaa !9, !range !26, !noundef !27
  %41 = trunc i8 %40 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  br i1 %41, label %59, label %42

42:                                               ; preds = %38
  %43 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 3
  %44 = call noundef i64 @_ZNKSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %43) #5
  %45 = icmp ugt i64 %44, 0
  br i1 %45, label %46, label %57

46:                                               ; preds = %42
  %47 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 3
  %48 = call ptr @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %47) #5
  %49 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %5, i32 0, i32 0
  store ptr %48, ptr %49, align 8
  %50 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmPN8graphlab11conditionalEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  %51 = getelementptr inbounds %"struct.std::pair", ptr %50, i32 0, i32 0
  %52 = load i64, ptr %51, align 8, !tbaa !28
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.graphlab::(anonymous namespace)::unfair_lock_priority", ptr %53, i32 0, i32 0
  %55 = load i64, ptr %54, align 8, !tbaa !30
  %56 = icmp ult i64 %52, %55
  br label %57

57:                                               ; preds = %46, %42
  %58 = phi i1 [ false, %42 ], [ %56, %46 ]
  br label %59

59:                                               ; preds = %57, %38
  %60 = phi i1 [ true, %38 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br i1 %60, label %61, label %78

61:                                               ; preds = %59
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.graphlab::(anonymous namespace)::unfair_lock_priority", ptr %62, i32 0, i32 1
  %64 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 1
  call void @_ZNK8graphlab11conditional4waitERKNS_5mutexE(ptr noundef nonnull align 8 dereferenceable(48) %63, ptr noundef nonnull align 8 dereferenceable(40) %64)
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.graphlab::(anonymous namespace)::unfair_lock_priority", ptr %65, i32 0, i32 0
  %67 = load i64, ptr %66, align 8, !tbaa !30
  %68 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 4
  %69 = load i64, ptr %68, align 8, !tbaa !33
  %70 = icmp ugt i64 %67, %69
  br i1 %70, label %71, label %77

71:                                               ; preds = %61
  %72 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 1
  call void @_ZNK8graphlab5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %72)
  %73 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 7
  %74 = load i32, ptr %73, align 8, !tbaa !34
  %75 = sext i32 %74 to i64
  call void @_ZN8graphlab5timer8sleep_msEm(i64 noundef %75)
  %76 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 1
  call void @_ZNK8graphlab5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %76)
  br label %77

77:                                               ; preds = %71, %61
  br label %38, !llvm.loop !35

78:                                               ; preds = %59
  %79 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 3
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.graphlab::(anonymous namespace)::unfair_lock_priority", ptr %80, i32 0, i32 0
  %82 = call noundef i64 @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5eraseERS6_(ptr noundef nonnull align 8 dereferenceable(48) %79, ptr noundef nonnull align 8 dereferenceable(8) %81)
  br label %83

83:                                               ; preds = %78, %29
  %84 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 0
  call void @_ZNK8graphlab5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %84)
  %85 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 2
  store volatile i8 1, ptr %85, align 8, !tbaa !9
  %86 = getelementptr inbounds %"class.graphlab::unfair_lock", ptr %6, i32 0, i32 1
  call void @_ZNK8graphlab5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %86)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN8graphlab12_GLOBAL__N_124get_unfair_lock_priorityEv() #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8graphlab5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEEixERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8graphlab11conditional4waitERKNS_5mutexE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8graphlab5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

declare void @_ZN8graphlab5timer8sleep_msEm(i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5eraseERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

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 = { 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 = { 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, !12, i64 80}
!10 = !{!"_ZTSN8graphlab11unfair_lockE", !11, i64 0, !11, i64 40, !12, i64 80, !13, i64 88, !21, i64 136, !22, i64 144, !23, i64 152, !22, i64 160, !23, i64 168, !21, i64 176, !12, i64 184, !24, i64 192}
!11 = !{!"_ZTSN8graphlab5mutexE", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"_ZTSSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE", !14, i64 0}
!14 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmPN8graphlab11conditionalEESt10_Select1stIS5_ESt4lessImESaIS5_EE", !15, i64 0}
!15 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmPN8graphlab11conditionalEESt10_Select1stIS5_ESt4lessImESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !16, i64 0, !18, i64 8}
!16 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !17, i64 0}
!17 = !{!"_ZTSSt4lessImE"}
!18 = !{!"_ZTSSt15_Rb_tree_header", !19, i64 0, !21, i64 32}
!19 = !{!"_ZTSSt18_Rb_tree_node_base", !20, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!"double", !7, i64 0}
!24 = !{!"_ZTSN8graphlab5timerE", !25, i64 0}
!25 = !{!"_ZTS7timeval", !21, i64 0, !21, i64 8}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!29, !21, i64 0}
!29 = !{!"_ZTSSt4pairIKmPN8graphlab11conditionalEE", !21, i64 0, !6, i64 8}
!30 = !{!31, !21, i64 0}
!31 = !{!"_ZTSN8graphlab12_GLOBAL__N_120unfair_lock_priorityE", !21, i64 0, !32, i64 8}
!32 = !{!"_ZTSN8graphlab11conditionalE", !7, i64 0}
!33 = !{!10, !21, i64 136}
!34 = !{!10, !22, i64 160}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


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

%"struct.std::_Rb_tree_iterator" = type { ptr }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8graphlab11unfair_lock4lockEv(ptr noundef nonnull align 8 dereferenceable(208) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %3 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %4 = tail call noundef ptr @_ZN8graphlab12_GLOBAL__N_124get_unfair_lock_priorityEv()
  %5 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @_ZNK8graphlab5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %5)
  %6 = getelementptr inbounds i8, ptr %0, i64 80
  %7 = load volatile i8, ptr %6, align 8, !tbaa !5, !range !25, !noundef !26
  %8 = trunc nuw i8 %7 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  br i1 %8, label %.critedge, label %9

9:                                                ; preds = %1
  %10 = getelementptr inbounds i8, ptr %0, i64 88
  %11 = tail call noundef i64 @_ZNKSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %10) #5
  %.not = icmp eq i64 %11, 0
  br i1 %.not, label %.critedge2, label %12

12:                                               ; preds = %9
  %13 = tail call ptr @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %10) #5
  store ptr %13, ptr %2, align 8
  %14 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmPN8graphlab11conditionalEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #5
  %15 = load i64, ptr %14, align 8, !tbaa !27
  %16 = load i64, ptr %4, align 8, !tbaa !29
  %17 = icmp ult i64 %15, %16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br i1 %17, label %18, label %43

.critedge:                                        ; preds = %1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br label %18

18:                                               ; preds = %.critedge, %12
  %19 = getelementptr inbounds i8, ptr %4, i64 8
  %20 = getelementptr inbounds i8, ptr %0, i64 88
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEEixERS6_(ptr noundef nonnull align 8 dereferenceable(48) %20, ptr noundef nonnull align 8 dereferenceable(8) %4)
  store ptr %19, ptr %21, align 8, !tbaa !32
  %22 = getelementptr inbounds i8, ptr %0, i64 136
  %23 = getelementptr inbounds i8, ptr %0, i64 160
  br label %24

24:                                               ; preds = %.backedge, %18
  %25 = load volatile i8, ptr %6, align 8, !tbaa !5, !range !25, !noundef !26
  %26 = trunc nuw i8 %25 to i1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  br i1 %26, label %.critedge4, label %27

27:                                               ; preds = %24
  %28 = call noundef i64 @_ZNKSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %20) #5
  %.not14 = icmp eq i64 %28, 0
  br i1 %.not14, label %.critedge6, label %29

29:                                               ; preds = %27
  %30 = call ptr @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %20) #5
  store ptr %30, ptr %3, align 8
  %31 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKmPN8graphlab11conditionalEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %32 = load i64, ptr %31, align 8, !tbaa !27
  %33 = load i64, ptr %4, align 8, !tbaa !29
  %34 = icmp ult i64 %32, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br i1 %34, label %35, label %.loopexit

.critedge4:                                       ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %35

35:                                               ; preds = %.critedge4, %29
  call void @_ZNK8graphlab11conditional4waitERKNS_5mutexE(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 8 dereferenceable(40) %5)
  %36 = load i64, ptr %4, align 8, !tbaa !29
  %37 = load i64, ptr %22, align 8, !tbaa !33
  %38 = icmp ugt i64 %36, %37
  br i1 %38, label %39, label %.backedge

39:                                               ; preds = %35
  call void @_ZNK8graphlab5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %5)
  %40 = load i32, ptr %23, align 8, !tbaa !34
  %41 = sext i32 %40 to i64
  call void @_ZN8graphlab5timer8sleep_msEm(i64 noundef %41)
  call void @_ZNK8graphlab5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %5)
  br label %.backedge

.backedge:                                        ; preds = %39, %35
  br label %24, !llvm.loop !35

.critedge6:                                       ; preds = %27
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %.loopexit

.loopexit:                                        ; preds = %29, %.critedge6
  %42 = call noundef i64 @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5eraseERS6_(ptr noundef nonnull align 8 dereferenceable(48) %20, ptr noundef nonnull align 8 dereferenceable(8) %4)
  br label %43

.critedge2:                                       ; preds = %9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br label %43

43:                                               ; preds = %.critedge2, %.loopexit, %12
  call void @_ZNK8graphlab5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  store volatile i8 1, ptr %6, align 8, !tbaa !5
  call void @_ZNK8graphlab5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40) %5)
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZN8graphlab12_GLOBAL__N_124get_unfair_lock_priorityEv() local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8graphlab5mutex4lockEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8graphlab11conditional4waitERKNS_5mutexE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK8graphlab5mutex6unlockEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 align 2

declare void @_ZN8graphlab5timer8sleep_msEm(i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE5eraseERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress 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 = { 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 = { 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, !10, i64 80}
!6 = !{!"_ZTSN8graphlab11unfair_lockE", !7, i64 0, !7, i64 40, !10, i64 80, !11, i64 88, !20, i64 136, !21, i64 144, !22, i64 152, !21, i64 160, !22, i64 168, !20, i64 176, !10, i64 184, !23, i64 192}
!7 = !{!"_ZTSN8graphlab5mutexE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"_ZTSSt3mapImPN8graphlab11conditionalESt4lessImESaISt4pairIKmS2_EEE", !12, i64 0}
!12 = !{!"_ZTSSt8_Rb_treeImSt4pairIKmPN8graphlab11conditionalEESt10_Select1stIS5_ESt4lessImESaIS5_EE", !13, i64 0}
!13 = !{!"_ZTSNSt8_Rb_treeImSt4pairIKmPN8graphlab11conditionalEESt10_Select1stIS5_ESt4lessImESaIS5_EE13_Rb_tree_implIS9_Lb1EEE", !14, i64 0, !16, i64 8}
!14 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessImEE", !15, i64 0}
!15 = !{!"_ZTSSt4lessImE"}
!16 = !{!"_ZTSSt15_Rb_tree_header", !17, i64 0, !20, i64 32}
!17 = !{!"_ZTSSt18_Rb_tree_node_base", !18, i64 0, !19, i64 8, !19, i64 16, !19, i64 24}
!18 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!19 = !{!"any pointer", !8, i64 0}
!20 = !{!"long", !8, i64 0}
!21 = !{!"int", !8, i64 0}
!22 = !{!"double", !8, i64 0}
!23 = !{!"_ZTSN8graphlab5timerE", !24, i64 0}
!24 = !{!"_ZTS7timeval", !20, i64 0, !20, i64 8}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!28, !20, i64 0}
!28 = !{!"_ZTSSt4pairIKmPN8graphlab11conditionalEE", !20, i64 0, !19, i64 8}
!29 = !{!30, !20, i64 0}
!30 = !{!"_ZTSN8graphlab12_GLOBAL__N_120unfair_lock_priorityE", !20, i64 0, !31, i64 8}
!31 = !{!"_ZTSN8graphlab11conditionalE", !8, i64 0}
!32 = !{!19, !19, i64 0}
!33 = !{!6, !20, i64 136}
!34 = !{!6, !21, i64 160}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass