; LLVM IR from turi-code/SFrame :: oss_src/graphlab/scheduler (queued_fifo_scheduler)

; 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.anon = type { ptr }
%"class.graphlab::queued_fifo_scheduler" = type { %"class.graphlab::ischeduler", i64, i64, i64, %"class.graphlab::dense_bitset", %"class.std::deque", %"class.graphlab::mutex", i64, %"class.std::vector.11", %"class.std::vector.13", %"class.std::vector.11", %"class.std::vector.13" }
%"class.graphlab::ischeduler" = type { ptr }
%"class.graphlab::dense_bitset" = type { ptr, i64, i64 }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::deque<unsigned long>, std::allocator<std::deque<unsigned long>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::deque<unsigned long>, std::allocator<std::deque<unsigned long>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::deque<unsigned long>, std::allocator<std::deque<unsigned long>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::deque<unsigned long>, std::allocator<std::deque<unsigned long>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"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::vector.11" = type { %"struct.std::_Vector_base.12" }
%"struct.std::_Vector_base.12" = type { %"struct.std::_Vector_base<std::deque<unsigned long>, std::allocator<std::deque<unsigned long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::deque<unsigned long>, std::allocator<std::deque<unsigned long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::deque<unsigned long>, std::allocator<std::deque<unsigned long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::deque<unsigned long>, std::allocator<std::deque<unsigned long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.13" = type { %"struct.std::_Vector_base.14" }
%"struct.std::_Vector_base.14" = type { %"struct.std::_Vector_base<graphlab::mutex, std::allocator<graphlab::mutex>>::_Vector_impl" }
%"struct.std::_Vector_base<graphlab::mutex, std::allocator<graphlab::mutex>>::_Vector_impl" = type { %"struct.std::_Vector_base<graphlab::mutex, std::allocator<graphlab::mutex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<graphlab::mutex, std::allocator<graphlab::mutex>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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 @_ZN8graphlab21queued_fifo_scheduler26initialize_data_structuresEv(ptr noundef nonnull align 8 dereferenceable(280) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca %class.anon, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  br label %7

7:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %8 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 1
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 3
  %11 = load i64, ptr %10, align 8, !tbaa !28
  %12 = mul i64 %9, %11
  store i64 %12, ptr %3, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 1, ptr %4, align 4, !tbaa !30
  %13 = load i64, ptr %3, align 8, !tbaa !29
  %14 = icmp ugt i64 %13, 1
  %15 = xor i1 %14, true
  %16 = zext i1 %15 to i64
  %17 = call i64 @llvm.expect.i64(i64 %16, i64 0)
  %18 = icmp ne i64 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %20 = getelementptr inbounds %class.anon, ptr %5, i32 0, i32 0
  store ptr %3, ptr %20, align 8, !tbaa !5
  call void @"_ZZN8graphlab21queued_fifo_scheduler26initialize_data_structuresEvENK3$_0clEv"(ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %21

21:                                               ; preds = %19, %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %22

22:                                               ; preds = %21
  %23 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 8
  %24 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 1
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 3
  %27 = load i64, ptr %26, align 8, !tbaa !28
  %28 = mul i64 %25, %27
  call void @_ZNSt6vectorISt5dequeImSaImEESaIS2_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %28)
  %29 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 9
  %30 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 1
  %31 = load i64, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 3
  %33 = load i64, ptr %32, align 8, !tbaa !28
  %34 = mul i64 %31, %33
  call void @_ZNSt6vectorIN8graphlab5mutexESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %34)
  %35 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 11
  %36 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 1
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 3
  %39 = load i64, ptr %38, align 8, !tbaa !28
  %40 = mul i64 %37, %39
  call void @_ZNSt6vectorIN8graphlab5mutexESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef %40)
  %41 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 10
  %42 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 1
  %43 = load i64, ptr %42, align 8, !tbaa !9
  call void @_ZNSt6vectorISt5dequeImSaImEESaIS2_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %43)
  %44 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 4
  %45 = getelementptr inbounds %"class.graphlab::queued_fifo_scheduler", ptr %6, i32 0, i32 2
  %46 = load i64, ptr %45, align 8, !tbaa !32
  call void @_ZN8graphlab12dense_bitset6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef %46)
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZN8graphlab21queued_fifo_scheduler26initialize_data_structuresEvENK3$_0clEv"(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8graphlab12dense_bitset6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #3 = { 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 #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, !12, i64 8}
!10 = !{!"_ZTSN8graphlab21queued_fifo_schedulerE", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32, !14, i64 56, !19, i64 136, !12, i64 176, !20, i64 184, !24, i64 208, !20, i64 232, !24, i64 256}
!11 = !{!"_ZTSN8graphlab10ischedulerE"}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTSN8graphlab12dense_bitsetE", !6, i64 0, !12, i64 8, !12, i64 16}
!14 = !{!"_ZTSSt5dequeIS_ImSaImEESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt11_Deque_baseISt5dequeImSaImEESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt11_Deque_baseISt5dequeImSaImEESaIS2_EE11_Deque_implE", !17, i64 0}
!17 = !{!"_ZTSNSt11_Deque_baseISt5dequeImSaImEESaIS2_EE16_Deque_impl_dataE", !6, i64 0, !12, i64 8, !18, i64 16, !18, i64 48}
!18 = !{!"_ZTSSt15_Deque_iteratorISt5dequeImSaImEERS2_PS2_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!19 = !{!"_ZTSN8graphlab5mutexE", !7, i64 0}
!20 = !{!"_ZTSSt6vectorISt5dequeImSaImEESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseISt5dequeImSaImEESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseISt5dequeImSaImEESaIS2_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt5dequeImSaImEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"_ZTSSt6vectorIN8graphlab5mutexESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseIN8graphlab5mutexESaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN8graphlab5mutexESaIS1_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIN8graphlab5mutexESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!10, !12, i64 24}
!29 = !{!12, !12, i64 0}
!30 = !{!31, !31, i64 0}
!31 = !{!"int", !7, i64 0}
!32 = !{!10, !12, 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"

%class.anon = 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 @_ZN8graphlab21queued_fifo_scheduler26initialize_data_structuresEv(ptr noundef nonnull align 8 dereferenceable(280) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca i64, align 8
  %3 = alloca %class.anon, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i64, ptr %6, align 8, !tbaa !27
  %8 = mul i64 %7, %5
  store i64 %8, ptr %2, align 8, !tbaa !28
  %9 = icmp ult i64 %8, 2
  br i1 %9, label %10, label %11, !prof !29

10:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  store ptr %2, ptr %3, align 8, !tbaa !30
  call void @"_ZZN8graphlab21queued_fifo_scheduler26initialize_data_structuresEvENK3$_0clEv"(ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  %.pre = load i64, ptr %4, align 8, !tbaa !5
  %.pre1 = load i64, ptr %6, align 8, !tbaa !27
  %.pre2 = mul i64 %.pre1, %.pre
  br label %11

11:                                               ; preds = %10, %1
  %.pre-phi = phi i64 [ %.pre2, %10 ], [ %8, %1 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 184
  call void @_ZNSt6vectorISt5dequeImSaImEESaIS2_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.pre-phi)
  %13 = getelementptr inbounds i8, ptr %0, i64 208
  %14 = load i64, ptr %4, align 8, !tbaa !5
  %15 = load i64, ptr %6, align 8, !tbaa !27
  %16 = mul i64 %15, %14
  call void @_ZNSt6vectorIN8graphlab5mutexESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %16)
  %17 = getelementptr inbounds i8, ptr %0, i64 256
  %18 = load i64, ptr %4, align 8, !tbaa !5
  %19 = load i64, ptr %6, align 8, !tbaa !27
  %20 = mul i64 %19, %18
  call void @_ZNSt6vectorIN8graphlab5mutexESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %20)
  %21 = getelementptr inbounds i8, ptr %0, i64 232
  %22 = load i64, ptr %4, align 8, !tbaa !5
  call void @_ZNSt6vectorISt5dequeImSaImEESaIS2_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %22)
  %23 = getelementptr inbounds i8, ptr %0, i64 32
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load i64, ptr %24, align 8, !tbaa !31
  call void @_ZN8graphlab12dense_bitset6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %25)
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZN8graphlab21queued_fifo_scheduler26initialize_data_structuresEvENK3$_0clEv"(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8graphlab12dense_bitset6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 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 = { 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, !8, i64 8}
!6 = !{!"_ZTSN8graphlab21queued_fifo_schedulerE", !7, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !11, i64 32, !13, i64 56, !18, i64 136, !8, i64 176, !19, i64 184, !23, i64 208, !19, i64 232, !23, i64 256}
!7 = !{!"_ZTSN8graphlab10ischedulerE"}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN8graphlab12dense_bitsetE", !12, i64 0, !8, i64 8, !8, i64 16}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"_ZTSSt5dequeIS_ImSaImEESaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt11_Deque_baseISt5dequeImSaImEESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSNSt11_Deque_baseISt5dequeImSaImEESaIS2_EE11_Deque_implE", !16, i64 0}
!16 = !{!"_ZTSNSt11_Deque_baseISt5dequeImSaImEESaIS2_EE16_Deque_impl_dataE", !12, i64 0, !8, i64 8, !17, i64 16, !17, i64 48}
!17 = !{!"_ZTSSt15_Deque_iteratorISt5dequeImSaImEERS2_PS2_E", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!18 = !{!"_ZTSN8graphlab5mutexE", !9, i64 0}
!19 = !{!"_ZTSSt6vectorISt5dequeImSaImEESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseISt5dequeImSaImEESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseISt5dequeImSaImEESaIS2_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseISt5dequeImSaImEESaIS2_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!23 = !{!"_ZTSSt6vectorIN8graphlab5mutexESaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIN8graphlab5mutexESaIS1_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN8graphlab5mutexESaIS1_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIN8graphlab5mutexESaIS1_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!27 = !{!6, !8, i64 24}
!28 = !{!8, !8, i64 0}
!29 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!30 = !{!12, !12, i64 0}
!31 = !{!6, !8, i64 16}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,ReassociatePass,SROAPass,SimplifyCFGPass