; LLVM IR from EdoPro98/SimSiPM :: src/SiPMSensor.ll (ZN4sipm10SiPMSensor18addCorrelatedNoiseEv)

; 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.sipm::SiPMSensor" = type { %"class.sipm::SiPMProperties", [56 x i8], %"class.sipm::SiPMRandom", i32, i32, i32, i32, i32, i32, %"class.std::vector", %"class.std::vector", %"class.std::vector.3", %"class.std::vector.8", %"class.sipm::SiPMAnalogSignal", [40 x i8] }
%"class.sipm::SiPMProperties" = type <{ double, double, i32, i32, i32, [4 x i8], double, double, i32, [4 x i8], double, double, double, double, double, double, double, double, double, double, double, double, double, float, [4 x i8], double, float, [4 x i8], double, double, %"class.std::map", i32, i8, i8, i8, i8, i8, [7 x i8] }>
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<double, std::pair<const double, double>, std::_Select1st<std::pair<const double, double>>, std::less<double>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<double, std::pair<const double, double>, std::_Select1st<std::pair<const double, double>>, std::less<double>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.sipm::SiPMRandom" = type { %"class.sipm::SiPMRng::Xorshift256plus" }
%"class.sipm::SiPMRng::Xorshift256plus" = type <{ [4 x i64], [32 x i8], [65536 x i64], i32, [60 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<sipm::SiPMHit *, std::allocator<sipm::SiPMHit *>>::_Vector_impl" }
%"struct.std::_Vector_base<sipm::SiPMHit *, std::allocator<sipm::SiPMHit *>>::_Vector_impl" = type { %"struct.std::_Vector_base<sipm::SiPMHit *, std::allocator<sipm::SiPMHit *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<sipm::SiPMHit *, std::allocator<sipm::SiPMHit *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.8" = type { %"struct.std::_Vector_base.9" }
%"struct.std::_Vector_base.9" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.sipm::SiPMAnalogSignal" = type { %"class.std::vector.8", double }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sipm10SiPMSensor18addCorrelatedNoiseEv(ptr noundef nonnull align 64 dereferenceable(524888) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  %13 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 0
  %14 = call noundef zeroext i1 @_ZNK4sipm14SiPMProperties5hasXtEv(ptr noundef nonnull align 8 dereferenceable(257) %13)
  %15 = zext i1 %14 to i8
  store i8 %15, ptr %3, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #5
  %16 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 0
  %17 = call noundef zeroext i1 @_ZNK4sipm14SiPMProperties5hasApEv(ptr noundef nonnull align 8 dereferenceable(257) %16)
  %18 = zext i1 %17 to i8
  store i8 %18, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %19 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 0
  %20 = call noundef double @_ZNK4sipm14SiPMProperties2xtEv(ptr noundef nonnull align 8 dereferenceable(257) %19)
  %21 = fneg double %20
  %22 = call double @exp(double noundef %21) #5
  store double %22, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %23 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 0
  %24 = call noundef double @_ZNK4sipm14SiPMProperties2apEv(ptr noundef nonnull align 8 dereferenceable(257) %23)
  %25 = fneg double %24
  %26 = call double @exp(double noundef %25) #5
  store double %26, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !13
  br label %27

27:                                               ; preds = %104, %1
  %28 = load i32, ptr %7, align 4, !tbaa !13
  %29 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 3
  %30 = load i32, ptr %29, align 64, !tbaa !15
  %31 = icmp ult i32 %28, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %107

33:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %34 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 2
  %35 = call noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416) %34) #5
  %36 = load i8, ptr %3, align 1, !tbaa !9, !range !45, !noundef !46
  %37 = trunc i8 %36 to i1
  %38 = zext i1 %37 to i32
  %39 = sitofp i32 %38 to double
  %40 = fmul double %35, %39
  store double %40, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %41 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 2
  %42 = call noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416) %41) #5
  %43 = load i8, ptr %4, align 1, !tbaa !9, !range !45, !noundef !46
  %44 = trunc i8 %43 to i1
  %45 = zext i1 %44 to i32
  %46 = sitofp i32 %45 to double
  %47 = fmul double %42, %46
  store double %47, ptr %9, align 8, !tbaa !11
  br label %48

48:                                               ; preds = %52, %33
  %49 = load double, ptr %8, align 8, !tbaa !11
  %50 = load double, ptr %5, align 8, !tbaa !11
  %51 = fcmp ogt double %49, %50
  br i1 %51, label %52, label %80

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %53 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 11
  %54 = load i32, ptr %7, align 4, !tbaa !13
  %55 = zext i32 %54 to i64
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %55) #5
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = call noundef ptr @_ZNK4sipm10SiPMSensor13generateXtHitEPKNS_7SiPMHitE(ptr noundef nonnull align 64 dereferenceable(524888) %12, ptr noundef %57)
  store ptr %58, ptr %10, align 8, !tbaa !5
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = call noundef zeroext i8 @_ZNK4sipm7SiPMHit7hitTypeEv(ptr noundef nonnull align 8 dereferenceable(29) %59) #5
  %61 = icmp eq i8 %60, 3
  %62 = zext i1 %61 to i32
  %63 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 7
  %64 = load i32, ptr %63, align 16, !tbaa !47
  %65 = add i32 %64, %62
  store i32 %65, ptr %63, align 16, !tbaa !47
  %66 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 11
  call void @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %66, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %67 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 3
  %68 = load i32, ptr %67, align 64, !tbaa !15
  %69 = add i32 %68, 1
  store i32 %69, ptr %67, align 64, !tbaa !15
  %70 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 6
  %71 = load i32, ptr %70, align 4, !tbaa !48
  %72 = add i32 %71, 1
  store i32 %72, ptr %70, align 4, !tbaa !48
  %73 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 4
  %74 = load i32, ptr %73, align 4, !tbaa !49
  %75 = add i32 %74, 1
  store i32 %75, ptr %73, align 4, !tbaa !49
  %76 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 2
  %77 = call noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416) %76) #5
  %78 = load double, ptr %8, align 8, !tbaa !11
  %79 = fmul double %78, %77
  store double %79, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %48, !llvm.loop !50

80:                                               ; preds = %48
  br label %81

81:                                               ; preds = %85, %80
  %82 = load double, ptr %9, align 8, !tbaa !11
  %83 = load double, ptr %6, align 8, !tbaa !11
  %84 = fcmp ogt double %82, %83
  br i1 %84, label %85, label %103

85:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %86 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 11
  %87 = load i32, ptr %7, align 4, !tbaa !13
  %88 = zext i32 %87 to i64
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef %88) #5
  %90 = load ptr, ptr %89, align 8, !tbaa !5
  %91 = call noundef ptr @_ZNK4sipm10SiPMSensor13generateApHitEPKNS_7SiPMHitE(ptr noundef nonnull align 64 dereferenceable(524888) %12, ptr noundef %90)
  store ptr %91, ptr %11, align 8, !tbaa !5
  %92 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 11
  call void @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %92, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %93 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 3
  %94 = load i32, ptr %93, align 64, !tbaa !15
  %95 = add i32 %94, 1
  store i32 %95, ptr %93, align 64, !tbaa !15
  %96 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 8
  %97 = load i32, ptr %96, align 4, !tbaa !52
  %98 = add i32 %97, 1
  store i32 %98, ptr %96, align 4, !tbaa !52
  %99 = getelementptr inbounds %"class.sipm::SiPMSensor", ptr %12, i32 0, i32 2
  %100 = call noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416) %99) #5
  %101 = load double, ptr %9, align 8, !tbaa !11
  %102 = fmul double %101, %100
  store double %102, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %81, !llvm.loop !53

103:                                              ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %7, align 4, !tbaa !13
  %106 = add i32 %105, 1
  store i32 %106, ptr %7, align 4, !tbaa !13
  br label %27, !llvm.loop !54

107:                                              ; preds = %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  ret void
}

; Function Attrs: nounwind
declare double @exp(double noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK4sipm10SiPMSensor13generateXtHitEPKNS_7SiPMHitE(ptr noundef nonnull align 64 dereferenceable(524888), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK4sipm10SiPMSensor13generateApHitEPKNS_7SiPMHitE(ptr noundef nonnull align 64 dereferenceable(524888), ptr noundef) #1 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZNK4sipm7SiPMHit7hitTypeEv(ptr noundef nonnull align 8 dereferenceable(29)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #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 = { 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 = { 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 #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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !14, i64 524736}
!16 = !{!"_ZTSN4sipm10SiPMSensorE", !17, i64 0, !30, i64 320, !14, i64 524736, !14, i64 524740, !14, i64 524744, !14, i64 524748, !14, i64 524752, !14, i64 524756, !32, i64 524760, !32, i64 524784, !36, i64 524808, !40, i64 524832, !44, i64 524856}
!17 = !{!"_ZTSN4sipm14SiPMPropertiesE", !12, i64 0, !12, i64 8, !14, i64 16, !14, i64 20, !18, i64 24, !12, i64 32, !12, i64 40, !14, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !19, i64 160, !12, i64 168, !19, i64 176, !12, i64 184, !12, i64 192, !20, i64 200, !29, i64 248, !10, i64 252, !10, i64 253, !10, i64 254, !10, i64 255, !10, i64 256}
!18 = !{!"_ZTSN4sipm14SiPMProperties15HitDistributionE", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!"_ZTSSt3mapIddSt4lessIdESaISt4pairIKddEEE", !21, i64 0}
!21 = !{!"_ZTSSt8_Rb_treeIdSt4pairIKddESt10_Select1stIS2_ESt4lessIdESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSNSt8_Rb_treeIdSt4pairIKddESt10_Select1stIS2_ESt4lessIdESaIS2_EE13_Rb_tree_implIS6_Lb1EEE", !23, i64 0, !25, i64 8}
!23 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIdEE", !24, i64 0}
!24 = !{!"_ZTSSt4lessIdE"}
!25 = !{!"_ZTSSt15_Rb_tree_header", !26, i64 0, !28, i64 32}
!26 = !{!"_ZTSSt18_Rb_tree_node_base", !27, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!27 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!28 = !{!"long", !7, i64 0}
!29 = !{!"_ZTSN4sipm14SiPMProperties7PdeTypeE", !7, i64 0}
!30 = !{!"_ZTSN4sipm10SiPMRandomE", !31, i64 0}
!31 = !{!"_ZTSN4sipm7SiPMRng15Xorshift256plusE", !7, i64 0, !7, i64 64, !14, i64 524352}
!32 = !{!"_ZTSSt6vectorIdSaIdEE", !33, i64 0}
!33 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !34, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!36 = !{!"_ZTSSt6vectorIPN4sipm7SiPMHitESaIS2_EE", !37, i64 0}
!37 = !{!"_ZTSSt12_Vector_baseIPN4sipm7SiPMHitESaIS2_EE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseIPN4sipm7SiPMHitESaIS2_EE12_Vector_implE", !39, i64 0}
!39 = !{!"_ZTSNSt12_Vector_baseIPN4sipm7SiPMHitESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!40 = !{!"_ZTSSt6vectorIfSaIfEE", !41, i64 0}
!41 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !42, i64 0}
!42 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !43, i64 0}
!43 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!44 = !{!"_ZTSN4sipm16SiPMAnalogSignalE", !40, i64 0, !12, i64 24}
!45 = !{i8 0, i8 2}
!46 = !{}
!47 = !{!16, !14, i64 524752}
!48 = !{!16, !14, i64 524748}
!49 = !{!16, !14, i64 524740}
!50 = distinct !{!50, !51}
!51 = !{!"llvm.loop.mustprogress"}
!52 = !{!16, !14, i64 524756}
!53 = distinct !{!53, !51}
!54 = distinct !{!54, !51}


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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sipm10SiPMSensor18addCorrelatedNoiseEv(ptr noundef nonnull align 64 dereferenceable(524888) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = tail call noundef zeroext i1 @_ZNK4sipm14SiPMProperties5hasXtEv(ptr noundef nonnull align 8 dereferenceable(257) %0)
  %5 = tail call noundef zeroext i1 @_ZNK4sipm14SiPMProperties5hasApEv(ptr noundef nonnull align 8 dereferenceable(257) %0)
  %6 = tail call noundef double @_ZNK4sipm14SiPMProperties2xtEv(ptr noundef nonnull align 8 dereferenceable(257) %0)
  %7 = fneg double %6
  %8 = tail call double @exp(double noundef %7) #5
  %9 = tail call noundef double @_ZNK4sipm14SiPMProperties2apEv(ptr noundef nonnull align 8 dereferenceable(257) %0)
  %10 = fneg double %9
  %11 = tail call double @exp(double noundef %10) #5
  %12 = getelementptr inbounds i8, ptr %0, i64 524736
  %13 = load i32, ptr %12, align 64, !tbaa !5
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %._crit_edge20, label %.lr.ph19

.lr.ph19:                                         ; preds = %1
  %14 = getelementptr inbounds i8, ptr %0, i64 320
  %15 = uitofp i1 %4 to double
  %16 = uitofp i1 %5 to double
  %17 = getelementptr inbounds i8, ptr %0, i64 524808
  %18 = getelementptr inbounds i8, ptr %0, i64 524752
  %19 = getelementptr inbounds i8, ptr %0, i64 524748
  %20 = getelementptr inbounds i8, ptr %0, i64 524756
  br label %21

._crit_edge20:                                    ; preds = %._crit_edge, %1
  ret void

21:                                               ; preds = %.lr.ph19, %._crit_edge
  %indvars.iv = phi i64 [ 0, %.lr.ph19 ], [ %indvars.iv.next, %._crit_edge ]
  %22 = call noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416) %14) #5
  %23 = fmul double %22, %15
  %24 = call noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416) %14) #5
  %25 = fmul double %24, %16
  %26 = fcmp ogt double %23, %8
  br i1 %26, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %21
  %27 = fcmp ogt double %25, %11
  br i1 %27, label %.lr.ph16, label %._crit_edge

.lr.ph:                                           ; preds = %21, %.lr.ph
  %.01214 = phi double [ %41, %.lr.ph ], [ %23, %21 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %indvars.iv) #5
  %29 = load ptr, ptr %28, align 8, !tbaa !41
  %30 = call noundef ptr @_ZNK4sipm10SiPMSensor13generateXtHitEPKNS_7SiPMHitE(ptr noundef nonnull align 64 dereferenceable(524888) %0, ptr noundef %29)
  store ptr %30, ptr %2, align 8, !tbaa !41
  %31 = call noundef zeroext i8 @_ZNK4sipm7SiPMHit7hitTypeEv(ptr noundef nonnull align 8 dereferenceable(29) %30) #5
  %32 = icmp eq i8 %31, 3
  %33 = zext i1 %32 to i32
  %34 = load i32, ptr %18, align 16, !tbaa !42
  %35 = add i32 %34, %33
  store i32 %35, ptr %18, align 16, !tbaa !42
  call void @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %36 = load i32, ptr %19, align 4, !tbaa !43
  %37 = add i32 %36, 1
  store i32 %37, ptr %19, align 4, !tbaa !43
  %38 = load <2 x i32>, ptr %12, align 64, !tbaa !44
  %39 = add <2 x i32> %38, <i32 1, i32 1>
  store <2 x i32> %39, ptr %12, align 64, !tbaa !44
  %40 = call noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416) %14) #5
  %41 = fmul double %.01214, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %42 = fcmp ogt double %41, %8
  br i1 %42, label %.lr.ph, label %.preheader, !llvm.loop !45

.lr.ph16:                                         ; preds = %.preheader, %.lr.ph16
  %.015 = phi double [ %51, %.lr.ph16 ], [ %25, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %indvars.iv) #5
  %44 = load ptr, ptr %43, align 8, !tbaa !41
  %45 = call noundef ptr @_ZNK4sipm10SiPMSensor13generateApHitEPKNS_7SiPMHitE(ptr noundef nonnull align 64 dereferenceable(524888) %0, ptr noundef %44)
  store ptr %45, ptr %3, align 8, !tbaa !41
  call void @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %46 = load i32, ptr %12, align 64, !tbaa !5
  %47 = add i32 %46, 1
  store i32 %47, ptr %12, align 64, !tbaa !5
  %48 = load i32, ptr %20, align 4, !tbaa !47
  %49 = add i32 %48, 1
  store i32 %49, ptr %20, align 4, !tbaa !47
  %50 = call noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416) %14) #5
  %51 = fmul double %.015, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %52 = fcmp ogt double %51, %11
  br i1 %52, label %.lr.ph16, label %._crit_edge, !llvm.loop !48

._crit_edge:                                      ; preds = %.lr.ph16, %.preheader
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %53 = load i32, ptr %12, align 64, !tbaa !5
  %54 = zext i32 %53 to i64
  %55 = icmp ult i64 %indvars.iv.next, %54
  br i1 %55, label %21, label %._crit_edge20, !llvm.loop !49
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZN4sipm10SiPMRandom4RandIdEET_v(ptr noundef nonnull align 64 dereferenceable(524416)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK4sipm10SiPMSensor13generateXtHitEPKNS_7SiPMHitE(ptr noundef nonnull align 64 dereferenceable(524888), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK4sipm10SiPMSensor13generateApHitEPKNS_7SiPMHitE(ptr noundef nonnull align 64 dereferenceable(524888), ptr noundef) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK4sipm14SiPMProperties2xtEv(ptr noundef nonnull align 8 dereferenceable(257)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK4sipm14SiPMProperties2apEv(ptr noundef nonnull align 8 dereferenceable(257)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZNK4sipm7SiPMHit7hitTypeEv(ptr noundef nonnull align 8 dereferenceable(29)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN4sipm7SiPMHitESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_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 nofree nounwind willreturn memory(write) "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 = { 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 #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, !11, i64 524736}
!6 = !{!"_ZTSN4sipm10SiPMSensorE", !7, i64 0, !26, i64 320, !11, i64 524736, !11, i64 524740, !11, i64 524744, !11, i64 524748, !11, i64 524752, !11, i64 524756, !28, i64 524760, !28, i64 524784, !32, i64 524808, !36, i64 524832, !40, i64 524856}
!7 = !{!"_ZTSN4sipm14SiPMPropertiesE", !8, i64 0, !8, i64 8, !11, i64 16, !11, i64 20, !12, i64 24, !8, i64 32, !8, i64 40, !11, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !8, i64 112, !8, i64 120, !8, i64 128, !8, i64 136, !8, i64 144, !8, i64 152, !13, i64 160, !8, i64 168, !13, i64 176, !8, i64 184, !8, i64 192, !14, i64 200, !24, i64 248, !25, i64 252, !25, i64 253, !25, i64 254, !25, i64 255, !25, i64 256}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTSN4sipm14SiPMProperties15HitDistributionE", !9, i64 0}
!13 = !{!"float", !9, i64 0}
!14 = !{!"_ZTSSt3mapIddSt4lessIdESaISt4pairIKddEEE", !15, i64 0}
!15 = !{!"_ZTSSt8_Rb_treeIdSt4pairIKddESt10_Select1stIS2_ESt4lessIdESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt8_Rb_treeIdSt4pairIKddESt10_Select1stIS2_ESt4lessIdESaIS2_EE13_Rb_tree_implIS6_Lb1EEE", !17, i64 0, !19, i64 8}
!17 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIdEE", !18, i64 0}
!18 = !{!"_ZTSSt4lessIdE"}
!19 = !{!"_ZTSSt15_Rb_tree_header", !20, i64 0, !23, i64 32}
!20 = !{!"_ZTSSt18_Rb_tree_node_base", !21, i64 0, !22, i64 8, !22, i64 16, !22, i64 24}
!21 = !{!"_ZTSSt14_Rb_tree_color", !9, i64 0}
!22 = !{!"any pointer", !9, i64 0}
!23 = !{!"long", !9, i64 0}
!24 = !{!"_ZTSN4sipm14SiPMProperties7PdeTypeE", !9, i64 0}
!25 = !{!"bool", !9, i64 0}
!26 = !{!"_ZTSN4sipm10SiPMRandomE", !27, i64 0}
!27 = !{!"_ZTSN4sipm7SiPMRng15Xorshift256plusE", !9, i64 0, !9, i64 64, !11, i64 524352}
!28 = !{!"_ZTSSt6vectorIdSaIdEE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !22, i64 0, !22, i64 8, !22, i64 16}
!32 = !{!"_ZTSSt6vectorIPN4sipm7SiPMHitESaIS2_EE", !33, i64 0}
!33 = !{!"_ZTSSt12_Vector_baseIPN4sipm7SiPMHitESaIS2_EE", !34, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIPN4sipm7SiPMHitESaIS2_EE12_Vector_implE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIPN4sipm7SiPMHitESaIS2_EE17_Vector_impl_dataE", !22, i64 0, !22, i64 8, !22, i64 16}
!36 = !{!"_ZTSSt6vectorIfSaIfEE", !37, i64 0}
!37 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !39, i64 0}
!39 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !22, i64 0, !22, i64 8, !22, i64 16}
!40 = !{!"_ZTSN4sipm16SiPMAnalogSignalE", !36, i64 0, !8, i64 24}
!41 = !{!22, !22, i64 0}
!42 = !{!6, !11, i64 524752}
!43 = !{!6, !11, i64 524748}
!44 = !{!11, !11, i64 0}
!45 = distinct !{!45, !46}
!46 = !{!"llvm.loop.mustprogress"}
!47 = !{!6, !11, i64 524756}
!48 = distinct !{!48, !46}
!49 = distinct !{!49, !46}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass