; LLVM IR from gem5/gem5 :: ext/systemc/src/sysc/utils (sc_hash)

; 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.sc_core::sc_phash_base_iter" = type <{ ptr, ptr, ptr, ptr, i32, [4 x i8] }>

; 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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core18sc_phash_base_iterppEi(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core18sc_phash_base_iterD2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #2 align 2

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

15:                                               ; preds = %30, %4
  %16 = invoke noundef zeroext i1 @_ZNK7sc_core18sc_phash_base_iter5emptyEv(ptr noundef nonnull align 8 dereferenceable(36) %9)
          to label %17 unwind label %31

17:                                               ; preds = %15
  %18 = xor i1 %16, true
  br i1 %18, label %19, label %35

19:                                               ; preds = %17
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = invoke noundef ptr @_ZNK7sc_core18sc_phash_base_iter3keyEv(ptr noundef nonnull align 8 dereferenceable(36) %9)
          to label %22 unwind label %31

22:                                               ; preds = %19
  %23 = invoke noundef ptr %20(ptr noundef %21)
          to label %24 unwind label %31

24:                                               ; preds = %22
  %25 = invoke noundef ptr @_ZNK7sc_core18sc_phash_base_iter8contentsEv(ptr noundef nonnull align 8 dereferenceable(36) %9)
          to label %26 unwind label %31

26:                                               ; preds = %24
  %27 = invoke noundef i32 @_ZN7sc_core13sc_phash_base6insertEPvS1_(ptr noundef nonnull align 8 dereferenceable(56) %12, ptr noundef %23, ptr noundef %25)
          to label %28 unwind label %31

28:                                               ; preds = %26
  br label %29

29:                                               ; preds = %28
  invoke void @_ZN7sc_core18sc_phash_base_iterppEi(ptr noundef nonnull align 8 dereferenceable(36) %9, i32 noundef 0)
          to label %30 unwind label %31

30:                                               ; preds = %29
  br label %15, !llvm.loop !9

31:                                               ; preds = %29, %26, %24, %22, %19, %15
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %10, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %11, align 4
  call void @_ZN7sc_core18sc_phash_base_iterD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %9) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #3
  br label %36

35:                                               ; preds = %17
  call void @_ZN7sc_core18sc_phash_base_iterD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %9) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr %9) #3
  ret void

36:                                               ; preds = %31
  %37 = load ptr, ptr %10, align 8
  %38 = load i32, ptr %11, align 4
  %39 = insertvalue { ptr, i32 } poison, ptr %37, 0
  %40 = insertvalue { ptr, i32 } %39, i32 %38, 1
  resume { ptr, i32 } %40
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7sc_core18sc_phash_base_iterC2ERNS_13sc_phash_baseE(ptr noundef nonnull align 8 dereferenceable(36), ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #1 align 2

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"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.sc_core::sc_phash_base_iter" = type <{ ptr, ptr, ptr, ptr, i32, [4 x i8] }>

; 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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core18sc_phash_base_iterppEi(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7sc_core18sc_phash_base_iterD2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7sc_core13sc_phash_base4copyERKS0_PFPvPKvEPFvS3_E(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr nocapture noundef readonly %2, ptr noundef %3) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.sc_core::sc_phash_base_iter", align 8
  tail call void @_ZN7sc_core13sc_phash_base5eraseEPFvPvE(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #3
  call void @_ZN7sc_core18sc_phash_base_iterC2ERNS_13sc_phash_baseE(ptr noundef nonnull align 8 dereferenceable(36) %5, ptr noundef nonnull align 8 dereferenceable(56) %1)
  %6 = call noundef zeroext i1 @_ZNK7sc_core18sc_phash_base_iter5emptyEv(ptr noundef nonnull align 8 dereferenceable(36) %5)
  br i1 %6, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4, %12
  %7 = call noundef ptr @_ZNK7sc_core18sc_phash_base_iter3keyEv(ptr noundef nonnull align 8 dereferenceable(36) %5)
  %8 = invoke noundef ptr %2(ptr noundef %7)
          to label %9 unwind label %14

9:                                                ; preds = %.lr.ph
  %10 = call noundef ptr @_ZNK7sc_core18sc_phash_base_iter8contentsEv(ptr noundef nonnull align 8 dereferenceable(36) %5)
  %11 = invoke noundef i32 @_ZN7sc_core13sc_phash_base6insertEPvS1_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %8, ptr noundef %10)
          to label %12 unwind label %14

12:                                               ; preds = %9
  call void @_ZN7sc_core18sc_phash_base_iterppEi(ptr noundef nonnull align 8 dereferenceable(36) %5, i32 noundef 0)
  %13 = call noundef zeroext i1 @_ZNK7sc_core18sc_phash_base_iter5emptyEv(ptr noundef nonnull align 8 dereferenceable(36) %5)
  br i1 %13, label %._crit_edge, label %.lr.ph, !llvm.loop !5

14:                                               ; preds = %9, %.lr.ph
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7sc_core18sc_phash_base_iterD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %5) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #3
  resume { ptr, i32 } %15

._crit_edge:                                      ; preds = %12, %4
  call void @_ZN7sc_core18sc_phash_base_iterD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %5) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7sc_core18sc_phash_base_iterC2ERNS_13sc_phash_baseE(ptr noundef nonnull align 8 dereferenceable(36), ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #1 align 2

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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