; LLVM IR from mitdbg/deneva :: system/msg_queue.ll (ZN12MessageQueue7dequeueEmRP7Message)

; 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.MessageQueue = type { ptr, %"class.std::vector", ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<msg_entry *, std::allocator<msg_entry *>>::_Vector_impl" }
%"struct.std::_Vector_base<msg_entry *, std::allocator<msg_entry *>>::_Vector_impl" = type { %"struct.std::_Vector_base<msg_entry *, std::allocator<msg_entry *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<msg_entry *, std::allocator<msg_entry *>>::_Vector_impl_data" = type { ptr, 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 }
%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 }
%struct.msg_entry = type { ptr, i64, i64 }
%class.Message = type { ptr, i32, i64, i64, i64, i64, i64, i64, double, double, double, double, double, double, double }

@g_this_send_thread_cnt = external global i32, align 4
@mem_allocator = external global %class.mem_alloc, align 1
@g_total_node_cnt = external global i32, align 4
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@simulation = external global ptr, align 8
@stats = external global %class.Stats, align 8
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@__PRETTY_FUNCTION__._ZN12MessageQueue7dequeueEmRP7Message = external hidden unnamed_addr constant [53 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare noundef i64 @_Z13get_sys_clockv() #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN12MessageQueue7dequeueEmRP7Message(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i8, align 1
  %11 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 -1, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %13 = call noundef i64 @_Z13get_sys_clockv()
  store i64 %13, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  store i8 0, ptr %10, align 1, !tbaa !11
  %14 = getelementptr inbounds %class.MessageQueue, ptr %12, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %16 = load i64, ptr %5, align 8, !tbaa !9
  %17 = load i32, ptr @g_this_send_thread_cnt, align 4, !tbaa !19
  %18 = zext i32 %17 to i64
  %19 = urem i64 %16, %18
  %20 = getelementptr inbounds ptr, ptr %15, i64 %19
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = call noundef zeroext i1 @_ZN5boost8lockfree5queueIP9msg_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136) %21, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %23 = zext i1 %22 to i8
  store i8 %23, ptr %10, align 1, !tbaa !11
  %24 = load ptr, ptr @simulation, align 8, !tbaa !5
  %25 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %24)
  br i1 %25, label %26, label %40

26:                                               ; preds = %3
  %27 = call noundef i64 @_Z13get_sys_clockv()
  %28 = load i64, ptr %9, align 8, !tbaa !9
  %29 = sub i64 %27, %28
  %30 = uitofp i64 %29 to double
  %31 = load ptr, ptr @stats, align 8, !tbaa !21
  %32 = load i64, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds ptr, ptr %31, i64 %32
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %35 = getelementptr inbounds %class.Stats_thd, ptr %34, i32 0, i32 197
  %36 = load ptr, ptr %35, align 8, !tbaa !23
  %37 = getelementptr inbounds double, ptr %36, i64 4
  %38 = load double, ptr %37, align 8, !tbaa !28
  %39 = fadd double %38, %30
  store double %39, ptr %37, align 8, !tbaa !28
  br label %40

40:                                               ; preds = %26, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %41 = call noundef i64 @_Z13get_sys_clockv()
  store i64 %41, ptr %11, align 8, !tbaa !9
  %42 = load i8, ptr %10, align 1, !tbaa !11, !range !29, !noundef !30
  %43 = trunc i8 %42 to i1
  br i1 %43, label %44, label %103

44:                                               ; preds = %40
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  br label %50

48:                                               ; preds = %44
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 108, ptr noundef @__PRETTY_FUNCTION__._ZN12MessageQueue7dequeueEmRP7Message) #5
  unreachable

49:                                               ; No predecessors!
  br label %50

50:                                               ; preds = %49, %47
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.msg_entry, ptr %51, i32 0, i32 1
  %53 = load i64, ptr %52, align 8, !tbaa !31
  store i64 %53, ptr %8, align 8, !tbaa !9
  %54 = load i64, ptr %8, align 8, !tbaa !9
  %55 = load i32, ptr @g_total_node_cnt, align 4, !tbaa !19
  %56 = zext i32 %55 to i64
  %57 = icmp ult i64 %54, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %50
  br label %61

59:                                               ; preds = %50
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 126, ptr noundef @__PRETTY_FUNCTION__._ZN12MessageQueue7dequeueEmRP7Message) #5
  unreachable

60:                                               ; No predecessors!
  br label %61

61:                                               ; preds = %60, %58
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.msg_entry, ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !33
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %64, ptr %65, align 8, !tbaa !5
  %66 = load ptr, ptr @simulation, align 8, !tbaa !5
  %67 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %66)
  br i1 %67, label %68, label %82

68:                                               ; preds = %61
  %69 = load i64, ptr %11, align 8, !tbaa !9
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.msg_entry, ptr %70, i32 0, i32 2
  %72 = load i64, ptr %71, align 8, !tbaa !34
  %73 = sub i64 %69, %72
  %74 = uitofp i64 %73 to double
  %75 = load ptr, ptr @stats, align 8, !tbaa !21
  %76 = load i64, ptr %5, align 8, !tbaa !9
  %77 = getelementptr inbounds ptr, ptr %75, i64 %76
  %78 = load ptr, ptr %77, align 8, !tbaa !5
  %79 = getelementptr inbounds %class.Stats_thd, ptr %78, i32 0, i32 64
  %80 = load double, ptr %79, align 8, !tbaa !35
  %81 = fadd double %80, %74
  store double %81, ptr %79, align 8, !tbaa !35
  br label %82

82:                                               ; preds = %68, %61
  %83 = load ptr, ptr @simulation, align 8, !tbaa !5
  %84 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %83)
  br i1 %84, label %85, label %93

85:                                               ; preds = %82
  %86 = load ptr, ptr @stats, align 8, !tbaa !21
  %87 = load i64, ptr %5, align 8, !tbaa !9
  %88 = getelementptr inbounds ptr, ptr %86, i64 %87
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = getelementptr inbounds %class.Stats_thd, ptr %89, i32 0, i32 65
  %91 = load i64, ptr %90, align 8, !tbaa !36
  %92 = add i64 %91, 1
  store i64 %92, ptr %90, align 8, !tbaa !36
  br label %93

93:                                               ; preds = %85, %82
  %94 = load i64, ptr %11, align 8, !tbaa !9
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.msg_entry, ptr %95, i32 0, i32 2
  %97 = load i64, ptr %96, align 8, !tbaa !34
  %98 = sub i64 %94, %97
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = load ptr, ptr %99, align 8, !tbaa !5
  %101 = getelementptr inbounds %class.Message, ptr %100, i32 0, i32 6
  store i64 %98, ptr %101, align 8, !tbaa !37
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1) @mem_allocator, ptr noundef %102, i64 noundef 24)
  br label %105

103:                                              ; preds = %40
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr null, ptr %104, align 8, !tbaa !5
  store i64 -1, ptr %8, align 8, !tbaa !9
  br label %105

105:                                              ; preds = %103, %93
  %106 = load ptr, ptr @simulation, align 8, !tbaa !5
  %107 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %106)
  br i1 %107, label %108, label %122

108:                                              ; preds = %105
  %109 = call noundef i64 @_Z13get_sys_clockv()
  %110 = load i64, ptr %11, align 8, !tbaa !9
  %111 = sub i64 %109, %110
  %112 = uitofp i64 %111 to double
  %113 = load ptr, ptr @stats, align 8, !tbaa !21
  %114 = load i64, ptr %5, align 8, !tbaa !9
  %115 = getelementptr inbounds ptr, ptr %113, i64 %114
  %116 = load ptr, ptr %115, align 8, !tbaa !5
  %117 = getelementptr inbounds %class.Stats_thd, ptr %116, i32 0, i32 197
  %118 = load ptr, ptr %117, align 8, !tbaa !23
  %119 = getelementptr inbounds double, ptr %118, i64 5
  %120 = load double, ptr %119, align 8, !tbaa !28
  %121 = fadd double %120, %112
  store double %121, ptr %119, align 8, !tbaa !28
  br label %122

122:                                              ; preds = %108, %105
  %123 = load i64, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret i64 %123
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5boost8lockfree5queueIP9msg_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 = { "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 = { nounwind }
attributes #5 = { noreturn 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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS12MessageQueue", !6, i64 0, !15, i64 8, !6, i64 32}
!15 = !{!"_ZTSSt6vectorIP9msg_entrySaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIP9msg_entrySaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIP9msg_entrySaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIP9msg_entrySaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!22, !6, i64 0}
!22 = !{!"_ZTS5Stats", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!23 = !{!24, !6, i64 1888}
!24 = !{!"_ZTS9Stats_thd", !7, i64 0, !6, i64 64, !6, i64 72, !25, 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, !25, i64 184, !10, i64 192, !25, i64 200, !10, i64 208, !25, i64 216, !10, i64 224, !10, i64 232, !25, i64 240, !25, i64 248, !25, i64 256, !25, i64 264, !25, i64 272, !25, i64 280, !25, i64 288, !25, i64 296, !10, i64 304, !25, i64 312, !25, i64 320, !25, i64 328, !25, i64 336, !25, i64 344, !25, i64 352, !25, i64 360, !25, i64 368, !10, i64 376, !10, i64 384, !25, i64 392, !10, i64 400, !25, i64 408, !10, i64 416, !25, i64 424, !25, i64 432, !25, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !25, i64 472, !25, i64 480, !25, i64 488, !25, i64 496, !25, i64 504, !25, i64 512, !25, i64 520, !25, i64 528, !25, i64 536, !10, i64 544, !6, i64 552, !6, i64 560, !25, i64 568, !10, i64 576, !10, i64 584, !25, i64 592, !25, i64 600, !25, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !10, i64 664, !25, i64 672, !25, i64 680, !25, 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, !25, i64 768, !25, i64 776, !25, i64 784, !25, i64 792, !25, i64 800, !10, i64 808, !10, i64 816, !25, i64 824, !25, i64 832, !10, i64 840, !10, i64 848, !10, i64 856, !25, i64 864, !25, i64 872, !10, i64 880, !10, i64 888, !25, i64 896, !25, i64 904, !25, i64 912, !25, i64 920, !10, i64 928, !10, i64 936, !25, i64 944, !25, i64 952, !25, i64 960, !10, i64 968, !10, i64 976, !25, i64 984, !25, i64 992, !25, i64 1000, !25, i64 1008, !25, i64 1016, !10, i64 1024, !25, i64 1032, !25, i64 1040, !25, i64 1048, !25, i64 1056, !25, i64 1064, !25, i64 1072, !25, i64 1080, !25, i64 1088, !10, i64 1096, !10, i64 1104, !10, i64 1112, !25, i64 1120, !10, i64 1128, !25, i64 1136, !25, i64 1144, !10, i64 1152, !10, i64 1160, !10, i64 1168, !10, i64 1176, !10, i64 1184, !25, i64 1192, !10, i64 1200, !10, i64 1208, !25, i64 1216, !10, i64 1224, !25, i64 1232, !25, i64 1240, !10, i64 1248, !10, i64 1256, !10, i64 1264, !10, i64 1272, !10, i64 1280, !25, i64 1288, !25, i64 1296, !25, i64 1304, !26, i64 1312, !26, i64 1384, !26, i64 1456, !26, i64 1528, !25, i64 1600, !25, i64 1608, !25, i64 1616, !25, i64 1624, !25, i64 1632, !25, i64 1640, !25, i64 1648, !25, i64 1656, !25, i64 1664, !25, i64 1672, !25, i64 1680, !25, i64 1688, !25, i64 1696, !25, i64 1704, !25, i64 1712, !25, i64 1720, !25, i64 1728, !25, i64 1736, !25, i64 1744, !25, i64 1752, !25, i64 1760, !25, i64 1768, !25, i64 1776, !25, i64 1784, !25, i64 1792, !25, i64 1800, !25, i64 1808, !25, i64 1816, !25, i64 1824, !25, i64 1832, !25, i64 1840, !25, i64 1848, !25, i64 1856, !25, i64 1864, !25, i64 1872, !25, i64 1880, !6, i64 1888, !7, i64 1896}
!25 = !{!"double", !7, i64 0}
!26 = !{!"_ZTS8StatsArr", !6, i64 0, !10, i64 8, !10, i64 16, !27, i64 24, !7, i64 32}
!27 = !{!"_ZTS12StatsArrType", !7, i64 0}
!28 = !{!25, !25, i64 0}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!32, !10, i64 8}
!32 = !{!"_ZTS9msg_entry", !6, i64 0, !10, i64 8, !10, i64 16}
!33 = !{!32, !6, i64 0}
!34 = !{!32, !10, i64 16}
!35 = !{!24, !25, i64 568}
!36 = !{!24, !10, i64 576}
!37 = !{!38, !10, i64 48}
!38 = !{!"_ZTS7Message", !39, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !25, i64 64, !25, i64 72, !25, i64 80, !25, i64 88, !25, i64 96, !25, i64 104, !25, i64 112}
!39 = !{!"_ZTS10RemReqType", !7, i64 0}


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

@g_this_send_thread_cnt = external local_unnamed_addr global i32, align 4
@mem_allocator = external global %class.mem_alloc, align 1
@g_total_node_cnt = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@simulation = external local_unnamed_addr global ptr, align 8
@stats = external local_unnamed_addr global %class.Stats, align 8
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1
@__PRETTY_FUNCTION__._ZN12MessageQueue7dequeueEmRP7Message = external hidden unnamed_addr constant [53 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare noundef i64 @_Z13get_sys_clockv() local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i64 -1, 4294967295) i64 @_ZN12MessageQueue7dequeueEmRP7Message(ptr nocapture noundef nonnull readonly align 8 dereferenceable(40) %0, i64 noundef %1, ptr nocapture noundef nonnull align 8 dereferenceable(8) %2) local_unnamed_addr #3 align 2 {
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  store ptr null, ptr %4, align 8, !tbaa !5
  %5 = tail call noundef i64 @_Z13get_sys_clockv()
  %6 = load ptr, ptr %0, align 8, !tbaa !9
  %7 = load i32, ptr @g_this_send_thread_cnt, align 4, !tbaa !15
  %8 = zext i32 %7 to i64
  %9 = urem i64 %1, %8
  %10 = getelementptr inbounds ptr, ptr %6, i64 %9
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = call noundef zeroext i1 @_ZN5boost8lockfree5queueIP9msg_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136) %11, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %13 = load ptr, ptr @simulation, align 8, !tbaa !5
  %14 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %13)
  br i1 %14, label %15, label %27

15:                                               ; preds = %3
  %16 = call noundef i64 @_Z13get_sys_clockv()
  %17 = sub i64 %16, %5
  %18 = uitofp i64 %17 to double
  %19 = load ptr, ptr @stats, align 8, !tbaa !17
  %20 = getelementptr inbounds ptr, ptr %19, i64 %1
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 1888
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  %24 = getelementptr inbounds i8, ptr %23, i64 32
  %25 = load double, ptr %24, align 8, !tbaa !25
  %26 = fadd double %25, %18
  store double %26, ptr %24, align 8, !tbaa !25
  br label %27

27:                                               ; preds = %15, %3
  %28 = call noundef i64 @_Z13get_sys_clockv()
  br i1 %12, label %29, label %72

29:                                               ; preds = %27
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %30, null
  br i1 %.not, label %31, label %32

31:                                               ; preds = %29
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 108, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN12MessageQueue7dequeueEmRP7Message) #5
  unreachable

32:                                               ; preds = %29
  %33 = getelementptr inbounds i8, ptr %30, i64 8
  %34 = load i64, ptr %33, align 8, !tbaa !26
  %35 = load i32, ptr @g_total_node_cnt, align 4, !tbaa !15
  %36 = zext i32 %35 to i64
  %37 = icmp ult i64 %34, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %32
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 126, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN12MessageQueue7dequeueEmRP7Message) #5
  unreachable

39:                                               ; preds = %32
  %40 = load ptr, ptr %30, align 8, !tbaa !28
  store ptr %40, ptr %2, align 8, !tbaa !5
  %41 = load ptr, ptr @simulation, align 8, !tbaa !5
  %42 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %41)
  br i1 %42, label %43, label %55

43:                                               ; preds = %39
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %46 = load i64, ptr %45, align 8, !tbaa !29
  %47 = sub i64 %28, %46
  %48 = uitofp i64 %47 to double
  %49 = load ptr, ptr @stats, align 8, !tbaa !17
  %50 = getelementptr inbounds ptr, ptr %49, i64 %1
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 568
  %53 = load double, ptr %52, align 8, !tbaa !30
  %54 = fadd double %53, %48
  store double %54, ptr %52, align 8, !tbaa !30
  br label %55

55:                                               ; preds = %43, %39
  %56 = load ptr, ptr @simulation, align 8, !tbaa !5
  %57 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %56)
  br i1 %57, label %58, label %65

58:                                               ; preds = %55
  %59 = load ptr, ptr @stats, align 8, !tbaa !17
  %60 = getelementptr inbounds ptr, ptr %59, i64 %1
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i64 576
  %63 = load i64, ptr %62, align 8, !tbaa !31
  %64 = add i64 %63, 1
  store i64 %64, ptr %62, align 8, !tbaa !31
  br label %65

65:                                               ; preds = %58, %55
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i64 16
  %68 = load i64, ptr %67, align 8, !tbaa !29
  %69 = sub i64 %28, %68
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %70, i64 48
  store i64 %69, ptr %71, align 8, !tbaa !32
  call void @_ZN9mem_alloc4freeEPvm(ptr noundef nonnull align 1 dereferenceable(1) @mem_allocator, ptr noundef %66, i64 noundef 24)
  br label %73

72:                                               ; preds = %27
  store ptr null, ptr %2, align 8, !tbaa !5
  br label %73

73:                                               ; preds = %72, %65
  %.0 = phi i64 [ %34, %65 ], [ -1, %72 ]
  %74 = load ptr, ptr @simulation, align 8, !tbaa !5
  %75 = call noundef zeroext i1 @_ZN10SimManager14is_warmup_doneEv(ptr noundef nonnull align 8 dereferenceable(96) %74)
  br i1 %75, label %76, label %88

76:                                               ; preds = %73
  %77 = call noundef i64 @_Z13get_sys_clockv()
  %78 = sub i64 %77, %28
  %79 = uitofp i64 %78 to double
  %80 = load ptr, ptr @stats, align 8, !tbaa !17
  %81 = getelementptr inbounds ptr, ptr %80, i64 %1
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %82, i64 1888
  %84 = load ptr, ptr %83, align 8, !tbaa !20
  %85 = getelementptr inbounds i8, ptr %84, i64 40
  %86 = load double, ptr %85, align 8, !tbaa !25
  %87 = fadd double %86, %79
  store double %87, ptr %85, align 8, !tbaa !25
  br label %88

88:                                               ; preds = %76, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret i64 %.0
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5boost8lockfree5queueIP9msg_entryJEE3popERS3_(ptr noundef nonnull align 8 dereferenceable(136), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass