; LLVM IR from gem5/gem5 :: ext/systemc/src/sysc/kernel/sc_thread_process.ll (ZN7sc_core16sc_thread_cor_fnEPv)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.sc_core::sc_halt" = type { i8 }
%"class.sc_core::sc_user" = type { i8 }

@_ZTIN7sc_core7sc_userE = external dso_local constant { ptr, ptr }, align 8
@_ZTIN7sc_core7sc_haltE = external dso_local constant { ptr, ptr }, align 8
@_ZTIN7sc_core19sc_unwind_exceptionE = external constant ptr
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7sc_core16sc_thread_cor_fnEPv(ptr noundef %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.sc_core::sc_halt", align 1
  %11 = alloca %"class.sc_core::sc_user", align 1
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  %14 = call noundef ptr @_ZN7sc_core22sc_get_curr_simcontextEv()
  store ptr %14, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %15, ptr %4, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %85, %31, %1
  br label %17

17:                                               ; preds = %16
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN7sc_core12sc_process_b9semanticsEv(ptr noundef nonnull align 8 dereferenceable(357) %18)
          to label %19 unwind label %20

19:                                               ; preds = %17
  br label %94

20:                                               ; preds = %17
  %21 = landingpad { ptr, i32 }
          catch ptr @_ZTIN7sc_core7sc_userE
          catch ptr @_ZTIN7sc_core7sc_haltE
          catch ptr @_ZTIN7sc_core19sc_unwind_exceptionE
          catch ptr null
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %5, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %6, align 4
  br label %24

24:                                               ; preds = %20
  %25 = load i32, ptr %6, align 4
  %26 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN7sc_core7sc_userE) #8
  %27 = icmp eq i32 %25, %26
  br i1 %27, label %28, label %33

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #8
  %29 = load ptr, ptr %5, align 8
  %30 = call ptr @__cxa_get_exception_ptr(ptr %29) #8
  invoke void @_ZN7sc_core7sc_userC2ERKS0_(ptr noundef nonnull align 1 dereferenceable(1) %11, ptr noundef nonnull align 1 dereferenceable(1) %30)
          to label %31 unwind label %124

31:                                               ; preds = %28
  %32 = call ptr @__cxa_begin_catch(ptr %29) #8
  store i32 2, ptr %9, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #8
  br label %16

33:                                               ; preds = %24
  %34 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN7sc_core7sc_haltE) #8
  %35 = icmp eq i32 %25, %34
  br i1 %35, label %36, label %50

36:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #8
  %37 = load ptr, ptr %5, align 8
  %38 = call ptr @__cxa_get_exception_ptr(ptr %37) #8
  invoke void @_ZN7sc_core7sc_haltC2ERKS0_(ptr noundef nonnull align 1 dereferenceable(1) %10, ptr noundef nonnull align 1 dereferenceable(1) %38)
          to label %39 unwind label %124

39:                                               ; preds = %36
  %40 = call ptr @__cxa_begin_catch(ptr %37) #8
  %41 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
          to label %42 unwind label %89

42:                                               ; preds = %39
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = invoke noundef ptr @_ZNK7sc_core9sc_object4nameEv(ptr noundef nonnull align 8 dereferenceable(112) %43)
          to label %45 unwind label %89

45:                                               ; preds = %42
  %46 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %41, ptr noundef %44)
          to label %47 unwind label %89

47:                                               ; preds = %45
  %48 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %46, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %49 unwind label %89

49:                                               ; preds = %47
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #8
  br label %94

50:                                               ; preds = %33
  %51 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN7sc_core19sc_unwind_exceptionE) #8
  %52 = icmp eq i32 %25, %51
  br i1 %52, label %53, label %65

53:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %54 = load ptr, ptr %5, align 8
  %55 = call ptr @__cxa_begin_catch(ptr %54) #8
  store ptr %55, ptr %8, align 8
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZNK7sc_core19sc_unwind_exception5clearEv(ptr noundef nonnull align 8 dereferenceable(17) %56)
          to label %57 unwind label %80

57:                                               ; preds = %53
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = getelementptr inbounds ptr, ptr %59, i64 3
  %61 = load ptr, ptr %60, align 8
  %62 = invoke noundef zeroext i1 %61(ptr noundef nonnull align 8 dereferenceable(17) %58)
          to label %63 unwind label %80

63:                                               ; preds = %57
  br i1 %62, label %64, label %84

64:                                               ; preds = %63
  store i32 2, ptr %9, align 4
  br label %85, !llvm.loop !11

65:                                               ; preds = %50
  %66 = load ptr, ptr %5, align 8
  %67 = call ptr @__cxa_begin_catch(ptr %66) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %68 = invoke noundef ptr @_ZN7sc_core19sc_handle_exceptionEv()
          to label %69 unwind label %75

69:                                               ; preds = %65
  store ptr %68, ptr %7, align 8, !tbaa !5
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = invoke noundef ptr @_ZNK7sc_core9sc_object10simcontextEv(ptr noundef nonnull align 8 dereferenceable(112) %70)
          to label %72 unwind label %75

72:                                               ; preds = %69
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_ZN7sc_core13sc_simcontext9set_errorEPNS_9sc_reportE(ptr noundef nonnull align 8 dereferenceable(344) %71, ptr noundef %73)
          to label %74 unwind label %75

74:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @__cxa_end_catch()
  br label %94

75:                                               ; preds = %72, %69, %65
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %5, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  invoke void @__cxa_end_catch()
          to label %79 unwind label %124

79:                                               ; preds = %75
  br label %118

80:                                               ; preds = %57, %53
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %5, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %88 unwind label %124

84:                                               ; preds = %63
  store i32 0, ptr %9, align 4
  br label %85

85:                                               ; preds = %84, %64
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %86 = load i32, ptr %9, align 4
  switch i32 %86, label %127 [
    i32 0, label %87
    i32 2, label %16
  ]

87:                                               ; preds = %85
  br label %94

88:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %118

89:                                               ; preds = %47, %45, %42, %39
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %5, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %6, align 4
  invoke void @__cxa_end_catch()
          to label %93 unwind label %124

93:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #8
  br label %118

94:                                               ; preds = %87, %74, %49, %19
  br label %95

95:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %96 = call noundef ptr @_ZN7sc_core24sc_get_current_process_bEv()
  store ptr %96, ptr %12, align 8, !tbaa !5
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN7sc_core12sc_process_b18disconnect_processEv(ptr noundef nonnull align 8 dereferenceable(357) %97)
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = call noundef ptr @_ZN7sc_core17sc_thread_process13next_runnableEv(ptr noundef nonnull align 8 dereferenceable(404) %98)
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %104

101:                                              ; preds = %95
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN7sc_core13sc_simcontext22remove_runnable_threadEPNS_17sc_thread_processE(ptr noundef nonnull align 8 dereferenceable(344) %102, ptr noundef %103)
  br label %104

104:                                              ; preds = %101, %95
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = icmp eq ptr %105, %106
  br i1 %107, label %108, label %117

108:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %109 = load ptr, ptr %3, align 8, !tbaa !5
  %110 = call noundef ptr @_ZN7sc_core13sc_simcontext8next_corEv(ptr noundef nonnull align 8 dereferenceable(344) %109)
  store ptr %110, ptr %13, align 8, !tbaa !5
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = call noundef ptr @_ZN7sc_core13sc_simcontext7cor_pkgEv(ptr noundef nonnull align 8 dereferenceable(344) %111)
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = load ptr, ptr %112, align 8, !tbaa !9
  %115 = getelementptr inbounds ptr, ptr %114, i64 4
  %116 = load ptr, ptr %115, align 8
  call void %116(ptr noundef nonnull align 8 dereferenceable(16) %112, ptr noundef %113)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %117

117:                                              ; preds = %108, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  ret void

118:                                              ; preds = %93, %88, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  br label %119

119:                                              ; preds = %118
  %120 = load ptr, ptr %5, align 8
  %121 = load i32, ptr %6, align 4
  %122 = insertvalue { ptr, i32 } poison, ptr %120, 0
  %123 = insertvalue { ptr, i32 } %122, i32 %121, 1
  resume { ptr, i32 } %123

124:                                              ; preds = %89, %80, %75, %36, %28
  %125 = landingpad { ptr, i32 }
          catch ptr null
  %126 = extractvalue { ptr, i32 } %125, 0
  call void @__clang_call_terminate(ptr %126) #9
  unreachable

127:                                              ; preds = %85
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7sc_core22sc_get_curr_simcontextEv() #2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #3

declare ptr @__cxa_begin_catch(ptr)

declare noundef ptr @_ZN7sc_core19sc_handle_exceptionEv() #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core13sc_simcontext9set_errorEPNS_9sc_reportE(ptr noundef nonnull align 8 dereferenceable(344), ptr noundef) #6 align 2

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

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #7

declare void @_ZNK7sc_core19sc_unwind_exception5clearEv(ptr noundef nonnull align 8 dereferenceable(17)) #4

declare ptr @__cxa_get_exception_ptr(ptr)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core7sc_haltC2ERKS0_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core7sc_userC2ERKS0_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7sc_core24sc_get_current_process_bEv() #2

declare void @_ZN7sc_core12sc_process_b18disconnect_processEv(ptr noundef nonnull align 8 dereferenceable(357)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7sc_core17sc_thread_process13next_runnableEv(ptr noundef nonnull align 8 dereferenceable(404)) #6 align 2

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

declare noundef ptr @_ZN7sc_core13sc_simcontext8next_corEv(ptr noundef nonnull align 8 dereferenceable(344)) #4

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 memory(none) }
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 = { 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 #6 = { inlinehint 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 #7 = { noinline noreturn nounwind uwtable "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 #8 = { nounwind }
attributes #9 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.sc_core::sc_halt" = type { i8 }
%"class.sc_core::sc_user" = type { i8 }

@_ZTIN7sc_core7sc_userE = external dso_local constant { ptr, ptr }, align 8
@_ZTIN7sc_core7sc_haltE = external dso_local constant { ptr, ptr }, align 8
@_ZTIN7sc_core19sc_unwind_exceptionE = external constant ptr
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7sc_core16sc_thread_cor_fnEPv(ptr noundef %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.sc_core::sc_halt", align 1
  %3 = alloca %"class.sc_core::sc_user", align 1
  %4 = tail call noundef ptr @_ZN7sc_core22sc_get_curr_simcontextEv()
  br label %.backedge

.backedge:                                        ; preds = %.backedge.backedge, %1
  invoke void @_ZN7sc_core12sc_process_b9semanticsEv(ptr noundef nonnull align 8 dereferenceable(357) %0)
          to label %.loopexit unwind label %5

5:                                                ; preds = %.backedge
  %6 = landingpad { ptr, i32 }
          catch ptr @_ZTIN7sc_core7sc_userE
          catch ptr @_ZTIN7sc_core7sc_haltE
          catch ptr @_ZTIN7sc_core19sc_unwind_exceptionE
          catch ptr null
  %7 = extractvalue { ptr, i32 } %6, 0
  %8 = extractvalue { ptr, i32 } %6, 1
  %9 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN7sc_core7sc_userE) #8
  %10 = icmp eq i32 %8, %9
  br i1 %10, label %11, label %14

11:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #8
  %12 = call ptr @__cxa_get_exception_ptr(ptr %7) #8
  call void @_ZN7sc_core7sc_userC2ERKS0_(ptr noundef nonnull align 1 dereferenceable(1) %3, ptr noundef nonnull align 1 dereferenceable(1) %12)
  %13 = call ptr @__cxa_begin_catch(ptr %7) #8
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #8
  br label %.backedge.backedge

.backedge.backedge:                               ; preds = %11, %37
  br label %.backedge

14:                                               ; preds = %5
  %15 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN7sc_core7sc_haltE) #8
  %16 = icmp eq i32 %8, %15
  br i1 %16, label %17, label %27

17:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #8
  %18 = call ptr @__cxa_get_exception_ptr(ptr %7) #8
  call void @_ZN7sc_core7sc_haltC2ERKS0_(ptr noundef nonnull align 1 dereferenceable(1) %2, ptr noundef nonnull align 1 dereferenceable(1) %18)
  %19 = call ptr @__cxa_begin_catch(ptr %7) #8
  %20 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
          to label %21 unwind label %46

21:                                               ; preds = %17
  %22 = call noundef ptr @_ZNK7sc_core9sc_object4nameEv(ptr noundef nonnull align 8 dereferenceable(112) %0)
  %23 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef %22)
          to label %24 unwind label %46

24:                                               ; preds = %21
  %25 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %26 unwind label %46

26:                                               ; preds = %24
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  br label %.loopexit

27:                                               ; preds = %14
  %28 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN7sc_core19sc_unwind_exceptionE) #8
  %29 = icmp eq i32 %8, %28
  %30 = call ptr @__cxa_begin_catch(ptr %7) #8
  br i1 %29, label %31, label %38

31:                                               ; preds = %27
  invoke void @_ZNK7sc_core19sc_unwind_exception5clearEv(ptr noundef nonnull align 8 dereferenceable(17) %30)
          to label %32 unwind label %44

32:                                               ; preds = %31
  %33 = load ptr, ptr %30, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 24
  %35 = load ptr, ptr %34, align 8
  %36 = invoke noundef zeroext i1 %35(ptr noundef nonnull align 8 dereferenceable(17) %30)
          to label %37 unwind label %44

37:                                               ; preds = %32
  call void @__cxa_end_catch()
  br i1 %36, label %.backedge.backedge, label %.loopexit

38:                                               ; preds = %27
  %39 = invoke noundef ptr @_ZN7sc_core19sc_handle_exceptionEv()
          to label %40 unwind label %42

40:                                               ; preds = %38
  %41 = call noundef ptr @_ZNK7sc_core9sc_object10simcontextEv(ptr noundef nonnull align 8 dereferenceable(112) %0)
  call void @_ZN7sc_core13sc_simcontext9set_errorEPNS_9sc_reportE(ptr noundef nonnull align 8 dereferenceable(344) %41, ptr noundef %39)
  call void @__cxa_end_catch()
  br label %.loopexit

42:                                               ; preds = %38
  %43 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %61 unwind label %62

44:                                               ; preds = %32, %31
  %45 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %61 unwind label %62

46:                                               ; preds = %24, %21, %17
  %47 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %48 unwind label %62

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

.loopexit:                                        ; preds = %37, %.backedge, %26, %40
  %49 = call noundef ptr @_ZN7sc_core24sc_get_current_process_bEv()
  call void @_ZN7sc_core12sc_process_b18disconnect_processEv(ptr noundef nonnull align 8 dereferenceable(357) %0)
  %50 = call noundef ptr @_ZN7sc_core17sc_thread_process13next_runnableEv(ptr noundef nonnull align 8 dereferenceable(404) %0)
  %.not = icmp eq ptr %50, null
  br i1 %.not, label %52, label %51

51:                                               ; preds = %.loopexit
  call void @_ZN7sc_core13sc_simcontext22remove_runnable_threadEPNS_17sc_thread_processE(ptr noundef nonnull align 8 dereferenceable(344) %4, ptr noundef nonnull %0)
  br label %52

52:                                               ; preds = %51, %.loopexit
  %53 = icmp eq ptr %49, %0
  br i1 %53, label %54, label %60

54:                                               ; preds = %52
  %55 = call noundef ptr @_ZN7sc_core13sc_simcontext8next_corEv(ptr noundef nonnull align 8 dereferenceable(344) %4)
  %56 = call noundef ptr @_ZN7sc_core13sc_simcontext7cor_pkgEv(ptr noundef nonnull align 8 dereferenceable(344) %4)
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 32
  %59 = load ptr, ptr %58, align 8
  call void %59(ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef %55)
  br label %60

60:                                               ; preds = %54, %52
  ret void

61:                                               ; preds = %44, %42, %48
  %.pn = phi { ptr, i32 } [ %47, %48 ], [ %43, %42 ], [ %45, %44 ]
  resume { ptr, i32 } %.pn

62:                                               ; preds = %46, %44, %42
  %63 = landingpad { ptr, i32 }
          catch ptr null
  %64 = extractvalue { ptr, i32 } %63, 0
  call void @__clang_call_terminate(ptr %64) #9
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7sc_core22sc_get_curr_simcontextEv() local_unnamed_addr #2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #3

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare noundef ptr @_ZN7sc_core19sc_handle_exceptionEv() local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core13sc_simcontext9set_errorEPNS_9sc_reportE(ptr noundef nonnull align 8 dereferenceable(344), ptr noundef) local_unnamed_addr #6 align 2

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

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #7

declare void @_ZNK7sc_core19sc_unwind_exception5clearEv(ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #4

declare ptr @__cxa_get_exception_ptr(ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core7sc_haltC2ERKS0_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core7sc_userC2ERKS0_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN7sc_core24sc_get_current_process_bEv() local_unnamed_addr #2

declare void @_ZN7sc_core12sc_process_b18disconnect_processEv(ptr noundef nonnull align 8 dereferenceable(357)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7sc_core17sc_thread_process13next_runnableEv(ptr noundef nonnull align 8 dereferenceable(404)) local_unnamed_addr #6 align 2

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

declare noundef ptr @_ZN7sc_core13sc_simcontext8next_corEv(ptr noundef nonnull align 8 dereferenceable(344)) local_unnamed_addr #4

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { nofree nosync nounwind memory(none) }
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 = { 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 #6 = { inlinehint 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 #7 = { noinline noreturn nounwind uwtable "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 #8 = { nounwind }
attributes #9 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


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