; LLVM IR from mitdbg/deneva :: system/abort_queue.ll (ZN10AbortQueue7processEm)

; 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.mem_alloc = type { i8 }
%class.Stats = type { ptr, ptr, i64, i64, i64, i64 }
%class.QWorkQueue = type { ptr, ptr, ptr, ptr, i64, ptr, i64 }
%class.AbortQueue = type { %"class.std::priority_queue", %union.pthread_mutex_t }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<abort_entry *, std::allocator<abort_entry *>>::_Vector_impl" }
%"struct.std::_Vector_base<abort_entry *, std::allocator<abort_entry *>>::_Vector_impl" = type { %"struct.std::_Vector_base<abort_entry *, std::allocator<abort_entry *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<abort_entry *, std::allocator<abort_entry *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%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.Stats_thd = type { [64 x i8], ptr, ptr, double, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, double, i64, double, i64, double, i64, i64, double, double, double, double, double, double, double, double, i64, double, double, double, double, double, double, double, double, i64, i64, double, i64, double, i64, double, double, double, i64, i64, i64, double, double, double, double, double, double, double, double, double, i64, ptr, ptr, double, i64, i64, double, double, double, i64, i64, i64, i64, i64, i64, i64, double, double, double, i64, i64, i64, i64, i64, i64, i64, i64, i64, double, double, double, double, double, i64, i64, double, double, i64, i64, i64, double, double, i64, i64, double, double, double, double, i64, i64, double, double, double, i64, i64, double, double, double, double, double, i64, double, double, double, double, double, double, double, double, i64, i64, i64, double, i64, double, double, i64, i64, i64, i64, i64, double, i64, i64, double, i64, double, double, i64, i64, i64, i64, i64, double, double, double, %class.StatsArr, %class.StatsArr, %class.StatsArr, %class.StatsArr, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, ptr, [64 x i8] }
%class.StatsArr = type { ptr, i64, i64, i32, %union.pthread_mutex_t }
%struct.abort_entry = type { i64, i64 }
%class.Message = type { ptr, i32, i64, i64, i64, i64, i64, i64, double, double, double, double, double, double, double }

@mem_allocator = external global %class.mem_alloc, align 1
@simulation = external global ptr, align 8
@stats = external global %class.Stats, align 8
@work_queue = external global %class.QWorkQueue, align 8

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

declare noundef i64 @_Z13get_sys_clockv() #1

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

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #2

declare noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96)) #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10AbortQueue7processEm(ptr noundef nonnull align 8 dereferenceable(72) %0, i64 noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %9 = load ptr, ptr %3, align 8
  %10 = getelementptr inbounds %class.AbortQueue, ptr %9, i32 0, i32 0
  %11 = call noundef zeroext i1 @_ZNKSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %10)
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  br label %107

13:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %14 = call noundef i64 @_Z13get_sys_clockv()
  store i64 %14, ptr %6, align 8, !tbaa !9
  %15 = getelementptr inbounds %class.AbortQueue, ptr %9, i32 0, i32 1
  %16 = call i32 @pthread_mutex_lock(ptr noundef %15) #5
  %17 = load ptr, ptr @simulation, align 8, !tbaa !5
  %18 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %17)
  br i1 %18, label %19, label %33

19:                                               ; preds = %13
  %20 = call noundef i64 @_Z13get_sys_clockv()
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = sub i64 %20, %21
  %23 = uitofp i64 %22 to double
  %24 = load ptr, ptr @stats, align 8, !tbaa !11
  %25 = load i64, ptr %4, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %24, i64 %25
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.Stats_thd, ptr %27, i32 0, i32 197
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = getelementptr inbounds double, ptr %29, i64 1
  %31 = load double, ptr %30, align 8, !tbaa !18
  %32 = fadd double %31, %23
  store double %32, ptr %30, align 8, !tbaa !18
  br label %33

33:                                               ; preds = %19, %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %34 = call noundef i64 @_Z13get_sys_clockv()
  store i64 %34, ptr %7, align 8, !tbaa !9
  br label %35

35:                                               ; preds = %88, %33
  %36 = getelementptr inbounds %class.AbortQueue, ptr %9, i32 0, i32 0
  %37 = call noundef zeroext i1 @_ZNKSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %36)
  %38 = xor i1 %37, true
  br i1 %38, label %39, label %89

39:                                               ; preds = %35
  %40 = getelementptr inbounds %class.AbortQueue, ptr %9, i32 0, i32 0
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %40)
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  store ptr %42, ptr %5, align 8, !tbaa !5
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.abort_entry, ptr %43, i32 0, i32 0
  %45 = load i64, ptr %44, align 8, !tbaa !19
  %46 = load i64, ptr %7, align 8, !tbaa !9
  %47 = icmp ult i64 %45, %46
  br i1 %47, label %48, label %87

48:                                               ; preds = %39
  %49 = getelementptr inbounds %class.AbortQueue, ptr %9, i32 0, i32 0
  call void @_ZNSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %49)
  %50 = load ptr, ptr @simulation, align 8, !tbaa !5
  %51 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %50)
  br i1 %51, label %52, label %66

52:                                               ; preds = %48
  %53 = load i64, ptr %7, align 8, !tbaa !9
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.abort_entry, ptr %54, i32 0, i32 0
  %56 = load i64, ptr %55, align 8, !tbaa !19
  %57 = sub i64 %53, %56
  %58 = uitofp i64 %57 to double
  %59 = load ptr, ptr @stats, align 8, !tbaa !11
  %60 = load i64, ptr %4, align 8, !tbaa !9
  %61 = getelementptr inbounds ptr, ptr %59, i64 %60
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %63 = getelementptr inbounds %class.Stats_thd, ptr %62, i32 0, i32 55
  %64 = load double, ptr %63, align 8, !tbaa !21
  %65 = fadd double %64, %58
  store double %65, ptr %63, align 8, !tbaa !21
  br label %66

66:                                               ; preds = %52, %48
  %67 = load ptr, ptr @simulation, align 8, !tbaa !5
  %68 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %67)
  br i1 %68, label %69, label %77

69:                                               ; preds = %66
  %70 = load ptr, ptr @stats, align 8, !tbaa !11
  %71 = load i64, ptr %4, align 8, !tbaa !9
  %72 = getelementptr inbounds ptr, ptr %70, i64 %71
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = getelementptr inbounds %class.Stats_thd, ptr %73, i32 0, i32 51
  %75 = load i64, ptr %74, align 8, !tbaa !22
  %76 = add i64 %75, 1
  store i64 %76, ptr %74, align 8, !tbaa !22
  br label %77

77:                                               ; preds = %69, %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %78 = call noundef ptr @_ZN7Message14create_messageE10RemReqType(i32 noundef 13)
  store ptr %78, ptr %8, align 8, !tbaa !5
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.abort_entry, ptr %79, i32 0, i32 1
  %81 = load i64, ptr %80, align 8, !tbaa !23
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %class.Message, ptr %82, i32 0, i32 2
  store i64 %81, ptr %83, align 8, !tbaa !24
  %84 = load i64, ptr %4, align 8, !tbaa !9
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN10QWorkQueue7enqueueEmP7Messageb(ptr noundef nonnull align 8 dereferenceable(56) @work_queue, i64 noundef %84, ptr noundef %85, i1 noundef zeroext false)
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1) @mem_allocator, ptr noundef %86, i64 noundef 16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %88

87:                                               ; preds = %39
  br label %89

88:                                               ; preds = %77
  br label %35, !llvm.loop !27

89:                                               ; preds = %87, %35
  %90 = getelementptr inbounds %class.AbortQueue, ptr %9, i32 0, i32 1
  %91 = call i32 @pthread_mutex_unlock(ptr noundef %90) #5
  %92 = load ptr, ptr @simulation, align 8, !tbaa !5
  %93 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %92)
  br i1 %93, label %94, label %106

94:                                               ; preds = %89
  %95 = call noundef i64 @_Z13get_sys_clockv()
  %96 = load i64, ptr %7, align 8, !tbaa !9
  %97 = sub i64 %95, %96
  %98 = uitofp i64 %97 to double
  %99 = load ptr, ptr @stats, align 8, !tbaa !11
  %100 = load i64, ptr %4, align 8, !tbaa !9
  %101 = getelementptr inbounds ptr, ptr %99, i64 %100
  %102 = load ptr, ptr %101, align 8, !tbaa !5
  %103 = getelementptr inbounds %class.Stats_thd, ptr %102, i32 0, i32 53
  %104 = load double, ptr %103, align 8, !tbaa !29
  %105 = fadd double %104, %98
  store double %105, ptr %103, align 8, !tbaa !29
  br label %106

106:                                              ; preds = %94, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %107

107:                                              ; preds = %106, %12
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #4 align 2

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

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

declare noundef ptr @_ZN7Message14create_messageE10RemReqType(i32 noundef) #1

declare void @_ZN10QWorkQueue7enqueueEmP7Messageb(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef, ptr noundef, i1 noundef zeroext) #1

declare void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, i64 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS5Stats", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!13 = !{!14, !6, i64 1888}
!14 = !{!"_ZTS9Stats_thd", !7, i64 0, !6, i64 64, !6, i64 72, !15, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !15, i64 184, !10, i64 192, !15, i64 200, !10, i64 208, !15, i64 216, !10, i64 224, !10, i64 232, !15, i64 240, !15, i64 248, !15, i64 256, !15, i64 264, !15, i64 272, !15, i64 280, !15, i64 288, !15, i64 296, !10, i64 304, !15, i64 312, !15, i64 320, !15, i64 328, !15, i64 336, !15, i64 344, !15, i64 352, !15, i64 360, !15, i64 368, !10, i64 376, !10, i64 384, !15, i64 392, !10, i64 400, !15, i64 408, !10, i64 416, !15, i64 424, !15, i64 432, !15, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !15, i64 472, !15, i64 480, !15, i64 488, !15, i64 496, !15, i64 504, !15, i64 512, !15, i64 520, !15, i64 528, !15, i64 536, !10, i64 544, !6, i64 552, !6, i64 560, !15, i64 568, !10, i64 576, !10, i64 584, !15, i64 592, !15, i64 600, !15, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !10, i64 664, !15, i64 672, !15, i64 680, !15, i64 688, !10, i64 696, !10, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !10, i64 760, !15, i64 768, !15, i64 776, !15, i64 784, !15, i64 792, !15, i64 800, !10, i64 808, !10, i64 816, !15, i64 824, !15, i64 832, !10, i64 840, !10, i64 848, !10, i64 856, !15, i64 864, !15, i64 872, !10, i64 880, !10, i64 888, !15, i64 896, !15, i64 904, !15, i64 912, !15, i64 920, !10, i64 928, !10, i64 936, !15, i64 944, !15, i64 952, !15, i64 960, !10, i64 968, !10, i64 976, !15, i64 984, !15, i64 992, !15, i64 1000, !15, i64 1008, !15, i64 1016, !10, i64 1024, !15, i64 1032, !15, i64 1040, !15, i64 1048, !15, i64 1056, !15, i64 1064, !15, i64 1072, !15, i64 1080, !15, i64 1088, !10, i64 1096, !10, i64 1104, !10, i64 1112, !15, i64 1120, !10, i64 1128, !15, i64 1136, !15, i64 1144, !10, i64 1152, !10, i64 1160, !10, i64 1168, !10, i64 1176, !10, i64 1184, !15, i64 1192, !10, i64 1200, !10, i64 1208, !15, i64 1216, !10, i64 1224, !15, i64 1232, !15, i64 1240, !10, i64 1248, !10, i64 1256, !10, i64 1264, !10, i64 1272, !10, i64 1280, !15, i64 1288, !15, i64 1296, !15, i64 1304, !16, i64 1312, !16, i64 1384, !16, i64 1456, !16, i64 1528, !15, i64 1600, !15, i64 1608, !15, i64 1616, !15, i64 1624, !15, i64 1632, !15, i64 1640, !15, i64 1648, !15, i64 1656, !15, i64 1664, !15, i64 1672, !15, i64 1680, !15, i64 1688, !15, i64 1696, !15, i64 1704, !15, i64 1712, !15, i64 1720, !15, i64 1728, !15, i64 1736, !15, i64 1744, !15, i64 1752, !15, i64 1760, !15, i64 1768, !15, i64 1776, !15, i64 1784, !15, i64 1792, !15, i64 1800, !15, i64 1808, !15, i64 1816, !15, i64 1824, !15, i64 1832, !15, i64 1840, !15, i64 1848, !15, i64 1856, !15, i64 1864, !15, i64 1872, !15, i64 1880, !6, i64 1888, !7, i64 1896}
!15 = !{!"double", !7, i64 0}
!16 = !{!"_ZTS8StatsArr", !6, i64 0, !10, i64 8, !10, i64 16, !17, i64 24, !7, i64 32}
!17 = !{!"_ZTS12StatsArrType", !7, i64 0}
!18 = !{!15, !15, i64 0}
!19 = !{!20, !10, i64 0}
!20 = !{!"_ZTS11abort_entry", !10, i64 0, !10, i64 8}
!21 = !{!14, !15, i64 496}
!22 = !{!14, !10, i64 464}
!23 = !{!20, !10, i64 8}
!24 = !{!25, !10, i64 16}
!25 = !{!"_ZTS7Message", !26, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104, !15, i64 112}
!26 = !{!"_ZTS10RemReqType", !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!14, !15, i64 480}


; 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.mem_alloc = type { i8 }
%class.Stats = type { ptr, ptr, i64, i64, i64, i64 }
%class.QWorkQueue = type { ptr, ptr, ptr, ptr, i64, ptr, i64 }

@mem_allocator = external global %class.mem_alloc, align 1
@simulation = external local_unnamed_addr global ptr, align 8
@stats = external local_unnamed_addr global %class.Stats, align 8
@work_queue = external global %class.QWorkQueue, align 8

declare noundef i64 @_Z13get_sys_clockv() local_unnamed_addr #0

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #0

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10AbortQueue7processEm(ptr noundef nonnull align 8 dereferenceable(72) %0, i64 noundef %1) local_unnamed_addr #2 align 2 {
  %3 = tail call noundef zeroext i1 @_ZNKSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %0)
  br i1 %3, label %71, label %4

4:                                                ; preds = %2
  %5 = tail call noundef i64 @_Z13get_sys_clockv()
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = tail call i32 @pthread_mutex_lock(ptr noundef nonnull %6) #4
  %8 = load ptr, ptr @simulation, align 8, !tbaa !5
  %9 = tail call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %8)
  br i1 %9, label %10, label %22

10:                                               ; preds = %4
  %11 = tail call noundef i64 @_Z13get_sys_clockv()
  %12 = sub i64 %11, %5
  %13 = uitofp i64 %12 to double
  %14 = load ptr, ptr @stats, align 8, !tbaa !9
  %15 = getelementptr inbounds ptr, ptr %14, i64 %1
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 1888
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %18, i64 8
  %20 = load double, ptr %19, align 8, !tbaa !17
  %21 = fadd double %20, %13
  store double %21, ptr %19, align 8, !tbaa !17
  br label %22

22:                                               ; preds = %10, %4
  %23 = tail call noundef i64 @_Z13get_sys_clockv()
  %24 = tail call noundef zeroext i1 @_ZNKSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %0)
  br i1 %24, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %22, %52
  %25 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %0)
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = load i64, ptr %26, align 8, !tbaa !18
  %28 = icmp ult i64 %27, %23
  br i1 %28, label %29, label %._crit_edge

29:                                               ; preds = %.lr.ph
  tail call void @_ZNSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %0)
  %30 = load ptr, ptr @simulation, align 8, !tbaa !5
  %31 = tail call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %30)
  br i1 %31, label %32, label %42

32:                                               ; preds = %29
  %33 = load i64, ptr %26, align 8, !tbaa !18
  %34 = sub i64 %23, %33
  %35 = uitofp i64 %34 to double
  %36 = load ptr, ptr @stats, align 8, !tbaa !9
  %37 = getelementptr inbounds ptr, ptr %36, i64 %1
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 496
  %40 = load double, ptr %39, align 8, !tbaa !20
  %41 = fadd double %40, %35
  store double %41, ptr %39, align 8, !tbaa !20
  br label %42

42:                                               ; preds = %32, %29
  %43 = load ptr, ptr @simulation, align 8, !tbaa !5
  %44 = tail call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %43)
  br i1 %44, label %45, label %52

45:                                               ; preds = %42
  %46 = load ptr, ptr @stats, align 8, !tbaa !9
  %47 = getelementptr inbounds ptr, ptr %46, i64 %1
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 464
  %50 = load i64, ptr %49, align 8, !tbaa !21
  %51 = add i64 %50, 1
  store i64 %51, ptr %49, align 8, !tbaa !21
  br label %52

52:                                               ; preds = %45, %42
  %53 = tail call noundef ptr @_ZN7Message14create_messageE10RemReqType(i32 noundef 13)
  %54 = getelementptr inbounds i8, ptr %26, i64 8
  %55 = load i64, ptr %54, align 8, !tbaa !22
  %56 = getelementptr inbounds i8, ptr %53, i64 16
  store i64 %55, ptr %56, align 8, !tbaa !23
  tail call void @_ZN10QWorkQueue7enqueueEmP7Messageb(ptr noundef nonnull align 8 dereferenceable(56) @work_queue, i64 noundef %1, ptr noundef %53, i1 noundef zeroext false)
  tail call void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1) @mem_allocator, ptr noundef nonnull %26, i64 noundef 16)
  %57 = tail call noundef zeroext i1 @_ZNKSt14priority_queueIP11abort_entrySt6vectorIS1_SaIS1_EE17CompareAbortEntryE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %0)
  br i1 %57, label %._crit_edge, label %.lr.ph, !llvm.loop !26

._crit_edge:                                      ; preds = %52, %.lr.ph, %22
  %58 = tail call i32 @pthread_mutex_unlock(ptr noundef nonnull %6) #4
  %59 = load ptr, ptr @simulation, align 8, !tbaa !5
  %60 = tail call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %59)
  br i1 %60, label %61, label %71

61:                                               ; preds = %._crit_edge
  %62 = tail call noundef i64 @_Z13get_sys_clockv()
  %63 = sub i64 %62, %23
  %64 = uitofp i64 %63 to double
  %65 = load ptr, ptr @stats, align 8, !tbaa !9
  %66 = getelementptr inbounds ptr, ptr %65, i64 %1
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 480
  %69 = load double, ptr %68, align 8, !tbaa !28
  %70 = fadd double %69, %64
  store double %70, ptr %68, align 8, !tbaa !28
  br label %71

71:                                               ; preds = %._crit_edge, %61, %2
  ret void
}

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

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

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

declare noundef ptr @_ZN7Message14create_messageE10RemReqType(i32 noundef) local_unnamed_addr #0

declare void @_ZN10QWorkQueue7enqueueEmP7Messageb(ptr noundef nonnull align 8 dereferenceable(56), i64 noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #0

declare void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, i64 noundef) local_unnamed_addr #0

attributes #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 = { 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 #2 = { 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 = { 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, !6, i64 0}
!10 = !{!"_ZTS5Stats", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !6, i64 1888}
!13 = !{!"_ZTS9Stats_thd", !7, i64 0, !6, i64 64, !6, i64 72, !14, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !14, i64 184, !11, i64 192, !14, i64 200, !11, i64 208, !14, i64 216, !11, i64 224, !11, i64 232, !14, i64 240, !14, i64 248, !14, i64 256, !14, i64 264, !14, i64 272, !14, i64 280, !14, i64 288, !14, i64 296, !11, i64 304, !14, i64 312, !14, i64 320, !14, i64 328, !14, i64 336, !14, i64 344, !14, i64 352, !14, i64 360, !14, i64 368, !11, i64 376, !11, i64 384, !14, i64 392, !11, i64 400, !14, i64 408, !11, i64 416, !14, i64 424, !14, i64 432, !14, i64 440, !11, i64 448, !11, i64 456, !11, i64 464, !14, i64 472, !14, i64 480, !14, i64 488, !14, i64 496, !14, i64 504, !14, i64 512, !14, i64 520, !14, i64 528, !14, i64 536, !11, i64 544, !6, i64 552, !6, i64 560, !14, i64 568, !11, i64 576, !11, i64 584, !14, i64 592, !14, i64 600, !14, i64 608, !11, i64 616, !11, i64 624, !11, i64 632, !11, i64 640, !11, i64 648, !11, i64 656, !11, i64 664, !14, i64 672, !14, i64 680, !14, i64 688, !11, i64 696, !11, i64 704, !11, i64 712, !11, i64 720, !11, i64 728, !11, i64 736, !11, i64 744, !11, i64 752, !11, i64 760, !14, i64 768, !14, i64 776, !14, i64 784, !14, i64 792, !14, i64 800, !11, i64 808, !11, i64 816, !14, i64 824, !14, i64 832, !11, i64 840, !11, i64 848, !11, i64 856, !14, i64 864, !14, i64 872, !11, i64 880, !11, i64 888, !14, i64 896, !14, i64 904, !14, i64 912, !14, i64 920, !11, i64 928, !11, i64 936, !14, i64 944, !14, i64 952, !14, i64 960, !11, i64 968, !11, i64 976, !14, i64 984, !14, i64 992, !14, i64 1000, !14, i64 1008, !14, i64 1016, !11, i64 1024, !14, i64 1032, !14, i64 1040, !14, i64 1048, !14, i64 1056, !14, i64 1064, !14, i64 1072, !14, i64 1080, !14, i64 1088, !11, i64 1096, !11, i64 1104, !11, i64 1112, !14, i64 1120, !11, i64 1128, !14, i64 1136, !14, i64 1144, !11, i64 1152, !11, i64 1160, !11, i64 1168, !11, i64 1176, !11, i64 1184, !14, i64 1192, !11, i64 1200, !11, i64 1208, !14, i64 1216, !11, i64 1224, !14, i64 1232, !14, i64 1240, !11, i64 1248, !11, i64 1256, !11, i64 1264, !11, i64 1272, !11, i64 1280, !14, i64 1288, !14, i64 1296, !14, i64 1304, !15, i64 1312, !15, i64 1384, !15, i64 1456, !15, i64 1528, !14, i64 1600, !14, i64 1608, !14, i64 1616, !14, i64 1624, !14, i64 1632, !14, i64 1640, !14, i64 1648, !14, i64 1656, !14, i64 1664, !14, i64 1672, !14, i64 1680, !14, i64 1688, !14, i64 1696, !14, i64 1704, !14, i64 1712, !14, i64 1720, !14, i64 1728, !14, i64 1736, !14, i64 1744, !14, i64 1752, !14, i64 1760, !14, i64 1768, !14, i64 1776, !14, i64 1784, !14, i64 1792, !14, i64 1800, !14, i64 1808, !14, i64 1816, !14, i64 1824, !14, i64 1832, !14, i64 1840, !14, i64 1848, !14, i64 1856, !14, i64 1864, !14, i64 1872, !14, i64 1880, !6, i64 1888, !7, i64 1896}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTS8StatsArr", !6, i64 0, !11, i64 8, !11, i64 16, !16, i64 24, !7, i64 32}
!16 = !{!"_ZTS12StatsArrType", !7, i64 0}
!17 = !{!14, !14, i64 0}
!18 = !{!19, !11, i64 0}
!19 = !{!"_ZTS11abort_entry", !11, i64 0, !11, i64 8}
!20 = !{!13, !14, i64 496}
!21 = !{!13, !11, i64 464}
!22 = !{!19, !11, i64 8}
!23 = !{!24, !11, i64 16}
!24 = !{!"_ZTS7Message", !25, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !14, i64 112}
!25 = !{!"_ZTS10RemReqType", !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!13, !14, i64 480}


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